Search in sources :

Example 1 with AbstractFormImplicitResponse

use of org.apache.cxf.rs.security.oauth2.common.AbstractFormImplicitResponse in project cxf by apache.

the class OidcHybridService method prepareFormResponse.

@Override
protected AbstractFormImplicitResponse prepareFormResponse(OAuthRedirectionState state, Client client, List<String> requestedScope, List<String> approvedScope, UserSubject userSubject, ServerAccessToken preAuthorizedToken) {
    ServerAuthorizationCodeGrant codeGrant = prepareHybrideCode(state, client, requestedScope, approvedScope, userSubject, preAuthorizedToken);
    AbstractFormImplicitResponse implResp = super.prepareFormResponse(state, client, requestedScope, approvedScope, userSubject, preAuthorizedToken);
    FormHybridResponse response = new FormHybridResponse();
    response.setResponseType(state.getResponseType());
    response.setRedirectUri(state.getRedirectUri());
    response.setState(state.getState());
    response.setImplicitResponse(implResp);
    if (codeGrant != null) {
        response.setCode(codeGrant.getCode());
    }
    return response;
}
Also used : ServerAuthorizationCodeGrant(org.apache.cxf.rs.security.oauth2.grants.code.ServerAuthorizationCodeGrant) AbstractFormImplicitResponse(org.apache.cxf.rs.security.oauth2.common.AbstractFormImplicitResponse)

Example 2 with AbstractFormImplicitResponse

use of org.apache.cxf.rs.security.oauth2.common.AbstractFormImplicitResponse in project cxf by apache.

the class AbstractImplicitGrantService method prepareFormResponse.

protected AbstractFormImplicitResponse prepareFormResponse(OAuthRedirectionState state, Client client, List<String> requestedScope, List<String> approvedScope, UserSubject userSubject, ServerAccessToken preAuthorizedToken) {
    ClientAccessToken clientToken = getClientAccessToken(state, client, requestedScope, approvedScope, userSubject, preAuthorizedToken);
    FormTokenResponse bean = new FormTokenResponse();
    bean.setResponseType(OAuthConstants.TOKEN_RESPONSE_TYPE);
    bean.setRedirectUri(state.getRedirectUri());
    bean.setState(state.getState());
    bean.setAccessToken(clientToken.getTokenKey());
    bean.setAccessTokenType(clientToken.getTokenType());
    bean.setAccessTokenExpiresIn(clientToken.getExpiresIn());
    bean.getParameters().putAll(clientToken.getParameters());
    return bean;
}
Also used : FormTokenResponse(org.apache.cxf.rs.security.oauth2.common.FormTokenResponse) ClientAccessToken(org.apache.cxf.rs.security.oauth2.common.ClientAccessToken)

Aggregations

AbstractFormImplicitResponse (org.apache.cxf.rs.security.oauth2.common.AbstractFormImplicitResponse)1 ClientAccessToken (org.apache.cxf.rs.security.oauth2.common.ClientAccessToken)1 FormTokenResponse (org.apache.cxf.rs.security.oauth2.common.FormTokenResponse)1 ServerAuthorizationCodeGrant (org.apache.cxf.rs.security.oauth2.grants.code.ServerAuthorizationCodeGrant)1