org.pac4j.core.engine.LogoutLogic Java Examples

The following examples show how to use org.pac4j.core.engine.LogoutLogic. 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: LogoutHandler.java    From vertx-pac4j with Apache License 2.0 6 votes vote down vote up
@Override
public void handle(final RoutingContext routingContext) {

    final LogoutLogic<Void, VertxWebContext> bestLogic = FindBest.logoutLogic(null, config, DefaultLogoutLogic.INSTANCE);
    final HttpActionAdapter<Void, VertxWebContext> bestAdapter = FindBest.httpActionAdapter(null, config, VertxHttpActionAdapter.INSTANCE);

    final VertxWebContext webContext = new VertxWebContext(routingContext, sessionStore);

    vertx.executeBlocking(future -> {
                bestLogic.perform(webContext, config, bestAdapter, defaultUrl, logoutUrlPattern, localLogout, destroySession, centralLogout);
                future.complete(null);
            },
            false,
            asyncResult -> {
                // If we succeeded we're all good here, the job is done either through approving, or redirect, or
                // forbidding
                // However, if an error occurred we need to handle this here
                if (asyncResult.failed()) {
                    routingContext.fail(new TechnicalException(asyncResult.cause()));
                }
            });

}
 
Example #2
Source File: DefaultFeatureSupport.java    From dropwizard-pac4j with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(Bootstrap<?> bootstrap) {
    ObjectMapper om = bootstrap.getObjectMapper();

    // for Config
    om.addMixIn(SessionStore.class, sessionStoreMixin());
    om.addMixIn(Authorizer.class, authorizerMixin());
    om.addMixIn(HttpActionAdapter.class, httpActionAdapterMixin());
    om.addMixIn(Matcher.class, matcherMixin());
    om.addMixIn(SecurityLogic.class, securityLogicMixin());
    om.addMixIn(CallbackLogic.class, callbackLogicMixin());
    om.addMixIn(LogoutLogic.class, logoutLogicMixin());

    // for Clients
    om.addMixIn(Client.class, clientMixin());
    om.addMixIn(BaseClient.class, baseClientMixin());

    // for Clients and Client subsclasses
    om.addMixIn(AjaxRequestResolver.class, ajaxRequestResolverMixin());
    om.addMixIn(UrlResolver.class, urlResolverMixin());
    om.addMixIn(CallbackUrlResolver.class, callbackUrlResolverMixin());
    om.addMixIn(AuthorizationGenerator.class,
            authorizationGeneratorMixin());

    // for Client/BaseClient
    om.addMixIn(Authenticator.class, authenticatorMixin());
    om.addMixIn(CredentialsExtractor.class, credentialExtractorMixin());
    om.addMixIn(ProfileCreator.class, profileCreatorMixin());

    // for IndirectClient
    om.addMixIn(RedirectActionBuilder.class, redirectActionBuilderMixin());
    om.addMixIn(LogoutActionBuilder.class, logoutActionBuilderMixin());
    
    // for some of the Authenticators
    om.addMixIn(PasswordEncoder.class, passwordEncoderMixin());
}
 
Example #3
Source File: LogoutFilter.java    From jax-rs-pac4j with Apache License 2.0 5 votes vote down vote up
protected LogoutLogic<Object, JaxRsContext> buildLogic(Config config) {
    if (logoutLogic != null) {
        return logoutLogic;
    } else if (config.getLogoutLogic() != null) {
        return config.getLogoutLogic();
    } else {
        DefaultLogoutLogic<Object, JaxRsContext> logic = new DefaultLogoutLogic<>();
        logic.setProfileManagerFactory(JaxRsProfileManager::new);
        return logic;
    }

}
 
Example #4
Source File: LogoutController.java    From spring-webmvc-pac4j with Apache License 2.0 5 votes vote down vote up
@RequestMapping("${pac4j.logout.path:/logout}")
public void logout(final HttpServletRequest request, final HttpServletResponse response) {

    final SessionStore<JEEContext> bestSessionStore = FindBest.sessionStore(null, config, JEESessionStore.INSTANCE);
    final HttpActionAdapter<Object, JEEContext> bestAdapter = FindBest.httpActionAdapter(null, config, JEEHttpActionAdapter.INSTANCE);
    final LogoutLogic<Object, JEEContext> bestLogic = FindBest.logoutLogic(logoutLogic, config, DefaultLogoutLogic.INSTANCE);

    final JEEContext context = (JEEContext) FindBest.webContextFactory(null, config, JEEContextFactory.INSTANCE)
            .newContext(request, response, bestSessionStore);
    bestLogic.perform(context, config, bestAdapter, this.defaultUrl, this.logoutUrlPattern,
            this.localLogout, this.destroySession, this.centralLogout);
}
 
Example #5
Source File: LogoutFilter.java    From jee-pac4j with Apache License 2.0 5 votes vote down vote up
@Override
protected void internalFilter(final HttpServletRequest request, final HttpServletResponse response,
                                       final FilterChain chain) throws IOException, ServletException {

    final Config config = getSharedConfig();

    final SessionStore<JEEContext> bestSessionStore = FindBest.sessionStore(null, config, JEESessionStore.INSTANCE);
    final HttpActionAdapter<Object, JEEContext> bestAdapter = FindBest.httpActionAdapter(null, config, JEEHttpActionAdapter.INSTANCE);
    final LogoutLogic<Object, JEEContext> bestLogic = FindBest.logoutLogic(logoutLogic, config, DefaultLogoutLogic.INSTANCE);

    final JEEContext context = new JEEContext(request, response, bestSessionStore);
    bestLogic.perform(context, config, bestAdapter, this.defaultUrl, this.logoutUrlPattern, this.localLogout, this.destroySession, this.centralLogout);
}
 
Example #6
Source File: Pac4jFactory.java    From dropwizard-pac4j with Apache License 2.0 4 votes vote down vote up
@JsonProperty
public LogoutLogic getLogoutLogic() {
    return logoutLogic;
}
 
Example #7
Source File: LogoutFilter.java    From jax-rs-pac4j with Apache License 2.0 4 votes vote down vote up
public LogoutLogic<Object, JaxRsContext> getLogoutLogic() {
    return logoutLogic;
}
 
Example #8
Source File: LogoutFilter.java    From jax-rs-pac4j with Apache License 2.0 4 votes vote down vote up
public void setLogoutLogic(LogoutLogic<Object, JaxRsContext> applicationLogoutLogic) {
    this.logoutLogic = applicationLogoutLogic;
}
 
Example #9
Source File: LogoutController.java    From spring-webmvc-pac4j with Apache License 2.0 4 votes vote down vote up
public LogoutLogic<Object, JEEContext> getLogoutLogic() {
    return logoutLogic;
}
 
Example #10
Source File: LogoutController.java    From spring-webmvc-pac4j with Apache License 2.0 4 votes vote down vote up
public void setLogoutLogic(final LogoutLogic<Object, JEEContext> logoutLogic) {
    this.logoutLogic = logoutLogic;
}
 
Example #11
Source File: Pac4jLogoutHandler.java    From pippo with Apache License 2.0 4 votes vote down vote up
public LogoutLogic<Object, PippoWebContext> getLogoutLogic() {
    return logoutLogic;
}
 
Example #12
Source File: Pac4jLogoutHandler.java    From pippo with Apache License 2.0 4 votes vote down vote up
public Pac4jLogoutHandler setLogoutLogic(LogoutLogic<Object, PippoWebContext> logoutLogic) {
    this.logoutLogic = logoutLogic;

    return this;
}
 
Example #13
Source File: LogoutFilter.java    From jee-pac4j with Apache License 2.0 4 votes vote down vote up
public LogoutLogic<Object, JEEContext> getLogoutLogic() {
    return logoutLogic;
}
 
Example #14
Source File: LogoutFilter.java    From jee-pac4j with Apache License 2.0 4 votes vote down vote up
public void setLogoutLogic(final LogoutLogic<Object, JEEContext> logoutLogic) {
    this.logoutLogic = logoutLogic;
}
 
Example #15
Source File: Pac4jFactory.java    From dropwizard-pac4j with Apache License 2.0 2 votes vote down vote up
/**
 * @since 1.1.1
 *
 * @param logoutLogic
 *            the {@link LogoutLogic} to use globally
 */
@JsonProperty
public void setLogoutLogic(LogoutLogic logoutLogic) {
    this.logoutLogic = logoutLogic;
}