use of org.wso2.carbon.identity.oauth.ciba.wrappers.CibaAuthResponseWrapper in project identity-inbound-auth-oauth by wso2-extensions.
the class CibaAuthzHandler method initiateAuthzRequest.
/**
* Trigger authorize request after building the url.
*
* @param authCodeResponse AuthorizeRequest Data Transfer Object..
* @throws CibaAuthFailureException CibaAuthentication related exception.
*/
public void initiateAuthzRequest(CibaAuthCodeResponse authCodeResponse, @Context HttpServletRequest request, @Context HttpServletResponse response) throws CibaAuthFailureException {
// Add custom parameters to the request by wrapping.
CibaAuthRequestWrapper cibaAuthRequestWrapper = new CibaAuthRequestWrapper(request);
cibaAuthRequestWrapper.setParameter(Constants.SCOPE, OAuth2Util.buildScopeString(authCodeResponse.getScopes()));
cibaAuthRequestWrapper.setParameter(Constants.RESPONSE_TYPE, CibaConstants.RESPONSE_TYPE_VALUE);
cibaAuthRequestWrapper.setParameter(Constants.NONCE, authCodeResponse.getAuthReqId());
cibaAuthRequestWrapper.setParameter(Constants.REDIRECT_URI, authCodeResponse.getCallBackUrl());
cibaAuthRequestWrapper.setParameter(Constants.CLIENT_ID, authCodeResponse.getClientId());
cibaAuthRequestWrapper.setParameter(CibaConstants.USER_IDENTITY, authCodeResponse.getUserHint());
cibaAuthRequestWrapper.setParameter(REQUEST_OBJECT, request.getParameter(CibaConstants.REQUEST));
cibaAuthRequestWrapper.setParameter(Constants.LOGIN_HINT, authCodeResponse.getUserHint());
if (!StringUtils.isBlank(authCodeResponse.getBindingMessage())) {
cibaAuthRequestWrapper.setParameter(CibaConstants.BINDING_MESSAGE, authCodeResponse.getBindingMessage());
}
if (!StringUtils.isBlank(authCodeResponse.getTransactionContext())) {
cibaAuthRequestWrapper.setParameter(CibaConstants.TRANSACTION_CONTEXT, authCodeResponse.getTransactionContext());
}
// Create an instance of response.
CibaAuthResponseWrapper commonAuthResponseWrapper = new CibaAuthResponseWrapper(response);
if (log.isDebugEnabled()) {
log.debug("Building AuthorizeRequest wrapper from CIBA component for the user : " + authCodeResponse.getUserHint() + " to continue the authentication request made by client with " + "clientID : " + authCodeResponse.getClientId());
}
// Fire authorize request and forget.
fireAuthzReq(cibaAuthRequestWrapper, commonAuthResponseWrapper);
}
Aggregations