Search in sources :

Example 1 with InteractiveAuth

use of org.ovirt.engine.core.sso.utils.InteractiveAuth in project ovirt-engine by oVirt.

the class InteractiveNextAuthServlet method service.

@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    Stack<InteractiveAuth> authStack = SsoUtils.getSsoSession(request).getAuthStack();
    if (authStack == null || authStack.isEmpty()) {
        SsoUtils.redirectToErrorPage(request, response, new OAuthException(SsoUtils.getSsoSession(request).isOpenIdScope() ? SsoConstants.ERR_CODE_OPENID_LOGIN_REQUIRED : SsoConstants.ERR_CODE_UNAUTHORIZED_CLIENT, ssoContext.getLocalizationUtils().localize(SsoConstants.APP_ERROR_AUTHENTICATION_REQUIRED, (Locale) request.getAttribute(SsoConstants.LOCALE))));
    } else {
        SsoUtils.getSsoSession(request).setStatus(SsoSession.Status.inprogress);
        response.sendRedirect(authStack.pop().getAuthUrl(request, response));
    }
}
Also used : OAuthException(org.ovirt.engine.core.sso.utils.OAuthException) InteractiveAuth(org.ovirt.engine.core.sso.utils.InteractiveAuth)

Aggregations

InteractiveAuth (org.ovirt.engine.core.sso.utils.InteractiveAuth)1 OAuthException (org.ovirt.engine.core.sso.utils.OAuthException)1