use of org.xdi.oxauth.model.ldap.TokenLdap in project oxAuth by GluuFederation.
the class AuthorizationGrant method asToken.
public TokenLdap asToken(RefreshToken p_token) {
final TokenLdap result = asTokenLdap(p_token);
result.setTokenTypeEnum(org.xdi.oxauth.model.ldap.TokenType.REFRESH_TOKEN);
return result;
}
use of org.xdi.oxauth.model.ldap.TokenLdap in project oxAuth by GluuFederation.
the class AuthorizationGrant method createIdToken.
@Override
public IdToken createIdToken(String nonce, AuthorizationCode authorizationCode, AccessToken accessToken, AuthorizationGrant authorizationGrant, boolean includeIdTokenClaims) throws SignatureException, StringEncrypter.EncryptionException, InvalidJwtException, InvalidJweException {
try {
final IdToken idToken = createIdToken(this, nonce, authorizationCode, accessToken, getScopes(), includeIdTokenClaims);
final String acrValues = authorizationGrant.getAcrValues();
final String sessionDn = authorizationGrant.getSessionDn();
if (idToken.getExpiresIn() > 0) {
final TokenLdap tokenLdap = asToken(idToken);
tokenLdap.setAuthMode(acrValues);
tokenLdap.setSessionDn(sessionDn);
persist(tokenLdap);
}
// is it really neccessary to propagate to all tokens?
setAcrValues(acrValues);
setSessionDn(sessionDn);
// asynchronous save
save();
return idToken;
} catch (Exception e) {
log.error(e.getMessage(), e);
return null;
}
}
use of org.xdi.oxauth.model.ldap.TokenLdap in project oxAuth by GluuFederation.
the class AuthorizationGrant method asToken.
public TokenLdap asToken(AuthorizationCode p_authorizationCode) {
final TokenLdap result = asTokenLdap(p_authorizationCode);
result.setTokenTypeEnum(org.xdi.oxauth.model.ldap.TokenType.AUTHORIZATION_CODE);
return result;
}
use of org.xdi.oxauth.model.ldap.TokenLdap in project oxAuth by GluuFederation.
the class AuthorizationGrant method saveImpl.
private void saveImpl() {
String grantId = getGrantId();
if (grantId != null && StringUtils.isNotBlank(grantId)) {
final List<TokenLdap> grants = grantService.getGrantsByGrantId(grantId);
if (grants != null && !grants.isEmpty()) {
final String nonce = getNonce();
final String scopes = getScopesAsString();
for (TokenLdap t : grants) {
t.setNonce(nonce);
t.setScope(scopes);
t.setAuthMode(getAcrValues());
t.setSessionDn(getSessionDn());
t.setAuthenticationTime(getAuthenticationTime());
t.setCodeChallenge(getCodeChallenge());
t.setCodeChallengeMethod(getCodeChallengeMethod());
final JwtAuthorizationRequest jwtRequest = getJwtAuthorizationRequest();
if (jwtRequest != null && StringUtils.isNotBlank(jwtRequest.getEncodedJwt())) {
t.setJwtRequest(jwtRequest.getEncodedJwt());
}
log.debug("Saving grant: " + grantId + ", code_challenge: " + getCodeChallenge());
grantService.mergeSilently(t);
}
}
}
}
use of org.xdi.oxauth.model.ldap.TokenLdap in project oxAuth by GluuFederation.
the class AuthorizationGrant method asToken.
public TokenLdap asToken(AccessToken p_accessToken) {
final TokenLdap result = asTokenLdap(p_accessToken);
result.setTokenTypeEnum(org.xdi.oxauth.model.ldap.TokenType.ACCESS_TOKEN);
return result;
}
Aggregations