use of org.wso2.carbon.identity.oauth2.token.OauthTokenIssuer in project identity-inbound-auth-oauth by wso2-extensions.
the class AbstractAuthorizationGrantHandler method createNewTokenBean.
private AccessTokenDO createNewTokenBean(OAuthTokenReqMessageContext tokReqMsgCtx, OAuthAppDO oAuthAppBean, AccessTokenDO existingTokenBean, Timestamp timestamp, long validityPeriodInMillis, OauthTokenIssuer oauthTokenIssuer) throws IdentityOAuth2Exception {
String tenantDomain = tokReqMsgCtx.getOauth2AccessTokenReqDTO().getTenantDomain();
OAuth2AccessTokenReqDTO tokenReq = tokReqMsgCtx.getOauth2AccessTokenReqDTO();
validateGrantTypeParam(tokenReq);
AccessTokenDO newTokenBean = new AccessTokenDO();
newTokenBean.setTokenState(TOKEN_STATE_ACTIVE);
newTokenBean.setConsumerKey(tokenReq.getClientId());
newTokenBean.setAuthzUser(tokReqMsgCtx.getAuthorizedUser());
newTokenBean.setScope(tokReqMsgCtx.getScope());
newTokenBean.setTenantID(OAuth2Util.getTenantId(tenantDomain));
newTokenBean.setTokenId(UUID.randomUUID().toString());
newTokenBean.setGrantType(tokenReq.getGrantType());
newTokenBean.setTokenType(getTokenType());
newTokenBean.setIssuedTime(timestamp);
newTokenBean.setAccessToken(getNewAccessToken(tokReqMsgCtx, oauthTokenIssuer));
newTokenBean.setValidityPeriodInMillis(validityPeriodInMillis);
newTokenBean.setValidityPeriod(validityPeriodInMillis / SECONDS_TO_MILISECONDS_FACTOR);
newTokenBean.setTokenBinding(tokReqMsgCtx.getTokenBinding());
setRefreshTokenDetails(tokReqMsgCtx, oAuthAppBean, existingTokenBean, timestamp, validityPeriodInMillis, tokenReq, newTokenBean, oauthTokenIssuer);
return newTokenBean;
}
Aggregations