use of org.gluu.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.gluu.oxauth.model.ldap.TokenType.ACCESS_TOKEN);
return result;
}
use of org.gluu.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()) {
for (TokenLdap t : grants) {
initTokenFromGrant(t);
log.debug("Saving grant: " + grantId + ", code_challenge: " + getCodeChallenge());
grantService.mergeSilently(t);
}
}
}
}
use of org.gluu.oxauth.model.ldap.TokenLdap in project oxAuth by GluuFederation.
the class AuthorizationGrant method createIdToken.
@Override
public IdToken createIdToken(String nonce, AuthorizationCode authorizationCode, AccessToken accessToken, RefreshToken refreshToken, String state, AuthorizationGrant authorizationGrant, boolean includeIdTokenClaims, Function<JsonWebResponse, Void> preProcessing, Function<JsonWebResponse, Void> postProcessing) {
try {
final IdToken idToken = createIdToken(this, nonce, authorizationCode, accessToken, refreshToken, state, getScopes(), includeIdTokenClaims, preProcessing, postProcessing);
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);
}
setAcrValues(acrValues);
setSessionDn(sessionDn);
statService.reportIdToken(getGrantType());
metricService.incCounter(MetricType.OXAUTH_TOKEN_ID_TOKEN_COUNT);
return idToken;
} catch (Exception e) {
log.error(e.getMessage(), e);
return null;
}
}
use of org.gluu.oxauth.model.ldap.TokenLdap in project oxAuth by GluuFederation.
the class AuthorizationGrant method asToken.
public TokenLdap asToken(IdToken p_token) {
final TokenLdap result = asTokenLdap(p_token);
result.setTokenTypeEnum(org.gluu.oxauth.model.ldap.TokenType.ID_TOKEN);
return result;
}
use of org.gluu.oxauth.model.ldap.TokenLdap in project oxAuth by GluuFederation.
the class AuthorizationGrantList method getAuthorizationGrant.
@Override
public List<AuthorizationGrant> getAuthorizationGrant(String clientId) {
final List<AuthorizationGrant> result = new ArrayList<>();
try {
final List<TokenLdap> entries = new ArrayList<TokenLdap>();
entries.addAll(grantService.getGrantsOfClient(clientId));
entries.addAll(grantService.getCacheClientTokensEntries(clientId));
for (TokenLdap t : entries) {
final AuthorizationGrant grant = asGrant(t);
if (grant != null) {
result.add(grant);
}
}
} catch (Exception e) {
log.trace(e.getMessage(), e);
}
return result;
}