use of org.gluu.oxauth.model.ldap.TokenLdap in project oxAuth by GluuFederation.
the class GrantService method logout.
public void logout(String sessionDn) {
final List<TokenLdap> tokens = getGrantsBySessionDn(sessionDn);
if (!appConfiguration.getRemoveRefreshTokensForClientOnLogout()) {
List<TokenLdap> refreshTokens = Lists.newArrayList();
for (TokenLdap token : tokens) {
if (token.getTokenTypeEnum() == TokenType.REFRESH_TOKEN) {
refreshTokens.add(token);
}
}
if (!refreshTokens.isEmpty()) {
log.trace("Refresh tokens are not removed on logout (because removeRefreshTokensForClientOnLogout configuration property is false)");
tokens.removeAll(refreshTokens);
}
}
removeSilently(tokens);
}
use of org.gluu.oxauth.model.ldap.TokenLdap in project oxAuth by GluuFederation.
the class GrantService method getCacheTokensEntries.
public List<TokenLdap> getCacheTokensEntries(Set<String> tokenHashes) {
List<TokenLdap> tokens = new ArrayList<>();
for (String tokenHash : tokenHashes) {
Object o1 = cacheService.get(tokenHash);
if (o1 instanceof TokenLdap) {
TokenLdap token = (TokenLdap) o1;
token.setIsFromCache(true);
tokens.add(token);
}
}
return tokens;
}
use of org.gluu.oxauth.model.ldap.TokenLdap in project oxAuth by GluuFederation.
the class GrantServiceTest method createTestToken.
private TokenLdap createTestToken() {
final String grantId = GrantService.generateGrantId();
final String dn = grantService.buildDn(TokenHashUtil.hash(TEST_TOKEN_CODE));
final TokenLdap t = new TokenLdap();
t.setDn(dn);
t.setGrantId(grantId);
t.setClientId(m_clientId);
t.setTokenCode(TokenHashUtil.hash(TEST_TOKEN_CODE));
t.setTokenType(TokenType.ACCESS_TOKEN.getValue());
t.setCreationDate(new Date());
t.setExpirationDate(new Date());
return t;
}