Search in sources :

Example 1 with AnonymousAuthorizationCallback

use of org.wildfly.security.auth.callback.AnonymousAuthorizationCallback in project keycloak by keycloak.

the class ElytronHttpFacade method authenticationCompleteAnonymous.

void authenticationCompleteAnonymous() {
    try {
        AnonymousAuthorizationCallback anonymousAuthorizationCallback = new AnonymousAuthorizationCallback(null);
        callbackHandler.handle(new Callback[] { anonymousAuthorizationCallback });
        if (anonymousAuthorizationCallback.isAuthorized()) {
            callbackHandler.handle(new Callback[] { AuthenticationCompleteCallback.SUCCEEDED, new SecurityIdentityCallback() });
            request.authenticationComplete(response -> response.forward(getRequest().getRelativePath()));
        } else {
            request.noAuthenticationInProgress(response -> response.forward(getRequest().getRelativePath()));
        }
    } catch (Exception e) {
        throw new RuntimeException("Unexpected error processing callbacks during logout.", e);
    }
}
Also used : AnonymousAuthorizationCallback(org.wildfly.security.auth.callback.AnonymousAuthorizationCallback) SecurityIdentityCallback(org.wildfly.security.auth.callback.SecurityIdentityCallback) IOException(java.io.IOException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Aggregations

IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 AnonymousAuthorizationCallback (org.wildfly.security.auth.callback.AnonymousAuthorizationCallback)1 SecurityIdentityCallback (org.wildfly.security.auth.callback.SecurityIdentityCallback)1