Search in sources :

Example 1 with VerifyResponse

use of org.openid4java.message.VerifyResponse in project cas by apereo.

the class OpenIdValidateController method handleRequestInternal.

@Override
public ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
    final String openIdMode = request.getParameter(OpenIdProtocolConstants.OPENID_MODE);
    if (StringUtils.equals(openIdMode, OpenIdProtocolConstants.CHECK_AUTHENTICATION)) {
        final VerifyResponse message = (VerifyResponse) this.serverManager.verify(new ParameterList(request.getParameterMap()));
        final Map<String, String> parameters = new HashMap<>();
        parameters.putAll(message.getParameterMap());
        if (message.isSignatureVerified()) {
            LOGGER.debug("Signature verification request successful.");
            return new ModelAndView(getSuccessView(), parameters);
        }
        LOGGER.debug("Signature verification request unsuccessful.");
        return new ModelAndView(getFailureView(), parameters);
    }
    // since we only deal OpenId signature verification
    return super.handleRequestInternal(request, response);
}
Also used : VerifyResponse(org.openid4java.message.VerifyResponse) HashMap(java.util.HashMap) ModelAndView(org.springframework.web.servlet.ModelAndView) ParameterList(org.openid4java.message.ParameterList)

Aggregations

HashMap (java.util.HashMap)1 ParameterList (org.openid4java.message.ParameterList)1 VerifyResponse (org.openid4java.message.VerifyResponse)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1