org.apache.catalina.authenticator.FormAuthenticator Java Examples

The following examples show how to use org.apache.catalina.authenticator.FormAuthenticator. 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: KeycloakAuthenticatorValve.java    From keycloak with Apache License 2.0 6 votes vote down vote up
@Override
protected boolean forwardToErrorPageInternal(Request request, HttpServletResponse response, Object loginConfig) throws IOException {
    if (loginConfig == null) return false;
    LoginConfig config = (LoginConfig)loginConfig;
    if (config.getErrorPage() == null) return false;
    // had to do this to get around compiler/IDE issues :(
    try {
        Method method = null;
        /*
        for (Method m : getClass().getDeclaredMethods()) {
            if (m.getName().equals("forwardToErrorPage")) {
                method = m;
                break;
            }
        }
        */
        method = FormAuthenticator.class.getDeclaredMethod("forwardToErrorPage", Request.class, HttpServletResponse.class, LoginConfig.class);
        method.setAccessible(true);
        method.invoke(this, request, response, config);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return true;
}
 
Example #2
Source File: SamlAuthenticatorValve.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean forwardToErrorPageInternal(Request request, HttpServletResponse response, Object loginConfig) throws IOException {
    if (loginConfig == null) return false;
    LoginConfig config = (LoginConfig)loginConfig;
    if (config.getErrorPage() == null) return false;
    // had to do this to get around compiler/IDE issues :(
    try {
        Method method = FormAuthenticator.class.getDeclaredMethod("forwardToErrorPage", Request.class, HttpServletResponse.class, LoginConfig.class);
        method.setAccessible(true);
        method.invoke(this, request, response, config);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return true;
}