All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.trajano.openidconnect.jaspic.internal.ValidateRequestProcessors Maven / Gradle / Ivy

The newest version!
package net.trajano.openidconnect.jaspic.internal;

import java.io.IOException;
import java.security.GeneralSecurityException;

import javax.security.auth.message.AuthStatus;

import net.trajano.openidconnect.jaspic.internal.processors.CallbackRequestProcessor;
import net.trajano.openidconnect.jaspic.internal.processors.IdTokenRequestProcessor;
import net.trajano.openidconnect.jaspic.internal.processors.LogoutGotoRequestProcessor;
import net.trajano.openidconnect.jaspic.internal.processors.LogoutRequestProcessor;
import net.trajano.openidconnect.jaspic.internal.processors.PostLogoutCallbackRequestProcessor;
import net.trajano.openidconnect.jaspic.internal.processors.SecurityAssertionFailureRequestProcessor;
import net.trajano.openidconnect.jaspic.internal.processors.SecurityAssertionPassedRequestProcessor;
import net.trajano.openidconnect.jaspic.internal.processors.UserInfoRequestProcessor;

public class ValidateRequestProcessors implements ValidateRequestProcessor {

    private static final ValidateRequestProcessors INSTANCE;

    static {
        INSTANCE = new ValidateRequestProcessors();
    }

    public static ValidateRequestProcessor getInstance() {

        return INSTANCE;
    }

    private final ValidateRequestProcessor[] processors = {

    new IdTokenRequestProcessor(),

    new UserInfoRequestProcessor(),

    new LogoutRequestProcessor(),

    new LogoutGotoRequestProcessor(),

    new SecurityAssertionFailureRequestProcessor(),

    new PostLogoutCallbackRequestProcessor(),

    new SecurityAssertionPassedRequestProcessor(),

    new CallbackRequestProcessor() };

    @Override
    public boolean canValidateRequest(final ValidateContext context) {

        for (final ValidateRequestProcessor processor : processors) {
            if (processor.canValidateRequest(context)) {
                return true;
            }
        }
        return false;
    }

    @Override
    public AuthStatus validateRequest(final ValidateContext context) throws IOException,
            GeneralSecurityException {

        for (final ValidateRequestProcessor processor : processors) {
            if (processor.canValidateRequest(context)) {
                return processor.validateRequest(context);
            }
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy