org.pac4j.core.util.CommonHelper Java Examples

The following examples show how to use org.pac4j.core.util.CommonHelper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SecurityHandler.java    From vertx-pac4j with Apache License 2.0 6 votes vote down vote up
public SecurityHandler(final Vertx vertx,
                       final SessionStore<VertxWebContext> sessionStore,
                       final Config config, final Pac4jAuthProvider authProvider,
                       final SecurityHandlerOptions options) {
    super(authProvider);
    CommonHelper.assertNotNull("vertx", vertx);
    CommonHelper.assertNotNull("sessionStore", sessionStore);
    CommonHelper.assertNotNull("config", config);
    CommonHelper.assertNotNull("config.getClients()", config.getClients());
    CommonHelper.assertNotNull("authProvider", authProvider);
    CommonHelper.assertNotNull("options", options);

    clientNames = options.getClients();
    authorizerName = options.getAuthorizers();
    matcherName = options.getMatchers();
    multiProfile = options.isMultiProfile();
    this.vertx = vertx;
    this.sessionStore = sessionStore;
    this.config = config;
}
 
Example #2
Source File: JaxRsContext.java    From jax-rs-pac4j with Apache License 2.0 5 votes vote down vote up
@Override
public void setResponseHeader(String name, String value) {
    CommonHelper.assertNotNull("name", name);
    // header() adds headers, so we must remove the previous value first
    getAbortBuilder().header(name, null);
    getAbortBuilder().header(name, value);
    getResponseHolder().setResponseHeader(name, value);
}
 
Example #3
Source File: JaxRsContext.java    From jax-rs-pac4j with Apache License 2.0 5 votes vote down vote up
@Override
public void addResponseCookie(Cookie cookie) {
    CommonHelper.assertNotNull("cookie", cookie);
    NewCookie c = new NewCookie(cookie.getName(), cookie.getValue(), cookie.getPath(),
            cookie.getDomain(), cookie.getVersion(), cookie.getComment(), cookie.getMaxAge(), cookie.getExpiry(),
            cookie.isSecure(), cookie.isHttpOnly());
    getAbortBuilder().cookie(c);
    getResponseHolder().addResponseCookie(c);
}
 
Example #4
Source File: ProvidersContext.java    From jax-rs-pac4j with Apache License 2.0 4 votes vote down vote up
public <A> Optional<A> resolve(Class<A> clazz) {
    ContextResolver<A> cr = providers.getContextResolver(clazz, MediaType.WILDCARD_TYPE);
    CommonHelper.assertNotNull("ContextResolver<" + clazz.getSimpleName() + ">", cr);
    return Optional.ofNullable(cr.getContext(null));
}
 
Example #5
Source File: ServletJaxRsContext.java    From jax-rs-pac4j with Apache License 2.0 4 votes vote down vote up
public ServletJaxRsContext(Providers providers, ContainerRequestContext requestContext,
        SessionStore sessionStore, HttpServletRequest request) {
    super(providers, requestContext, sessionStore != null ? sessionStore : new ServletSessionStore());
    CommonHelper.assertNotNull("request", request);
    this.request = request;
}
 
Example #6
Source File: AbstractConfigFilter.java    From jee-pac4j with Apache License 2.0 4 votes vote down vote up
public void setSharedConfig(final Config config) {
    CommonHelper.assertNotNull("config", config);
    this.config = config;
    Config.setConfig(config);
}
 
Example #7
Source File: AbstractConfigFilter.java    From jee-pac4j with Apache License 2.0 4 votes vote down vote up
public void setConfigOnly(final Config config) {
    CommonHelper.assertNotNull("config", config);
    this.config = config;
}