use of org.wso2.carbon.identity.oauth.cache.AuthorizationGrantCacheKey in project identity-inbound-auth-oauth by wso2-extensions.
the class IdentityOathEventListener method removeAuthzCodesFromCache.
private void removeAuthzCodesFromCache(List<AuthzCodeDO> authorizationCodeDOSet) {
if (CollectionUtils.isNotEmpty(authorizationCodeDOSet)) {
for (AuthzCodeDO authorizationCodeDO : authorizationCodeDOSet) {
String authorizationCode = authorizationCodeDO.getAuthorizationCode();
String authzCodeId = authorizationCodeDO.getAuthzCodeId();
AuthorizationGrantCacheKey cacheKey = new AuthorizationGrantCacheKey(authorizationCode);
AuthorizationGrantCache.getInstance().clearCacheEntryByCodeId(cacheKey, authzCodeId);
}
}
}
use of org.wso2.carbon.identity.oauth.cache.AuthorizationGrantCacheKey in project identity-inbound-auth-oauth by wso2-extensions.
the class IdentityOathEventListener method removeAccessTokensFromCache.
private void removeAccessTokensFromCache(Set<AccessTokenDO> accessTokenDOSet) {
if (CollectionUtils.isNotEmpty(accessTokenDOSet)) {
for (AccessTokenDO accessTokenDO : accessTokenDOSet) {
String accessToken = accessTokenDO.getAccessToken();
String tokenId = accessTokenDO.getTokenId();
AuthorizationGrantCacheKey cacheKey = new AuthorizationGrantCacheKey(accessToken);
AuthorizationGrantCache.getInstance().clearCacheEntryByTokenId(cacheKey, tokenId);
}
}
}
use of org.wso2.carbon.identity.oauth.cache.AuthorizationGrantCacheKey in project identity-inbound-auth-oauth by wso2-extensions.
the class OAuthApplicationMgtListener method clearCacheEntriesAgainstToken.
private void clearCacheEntriesAgainstToken(Set<AccessTokenDO> accessTokenDOSet) {
for (AccessTokenDO accessTokenDo : accessTokenDOSet) {
// Remove access token from AuthorizationGrantCache
AuthorizationGrantCacheKey grantCacheKey = new AuthorizationGrantCacheKey(accessTokenDo.getAccessToken());
AuthorizationGrantCache.getInstance().clearCacheEntryByTokenId(grantCacheKey, accessTokenDo.getTokenId());
// Remove access token from OAuthCache
OAuthCacheKey oauthCacheKey = new OAuthCacheKey(accessTokenDo.getAccessToken());
CacheEntry oauthCacheEntry = OAuthCache.getInstance().getValueFromCache(oauthCacheKey);
if (oauthCacheEntry != null) {
OAuthCache.getInstance().clearCacheEntry(oauthCacheKey);
}
}
}
use of org.wso2.carbon.identity.oauth.cache.AuthorizationGrantCacheKey in project identity-inbound-auth-oauth by wso2-extensions.
the class OAuthApplicationMgtListener method clearCacheEntriesAgainstAuthzCode.
private void clearCacheEntriesAgainstAuthzCode(Set<AuthzCodeDO> authzCodeDOSet) {
for (AuthzCodeDO authzCodeDO : authzCodeDOSet) {
// Remove authorization code from AuthorizationGrantCache
AuthorizationGrantCacheKey grantCacheKey = new AuthorizationGrantCacheKey(authzCodeDO.getAuthorizationCode());
AuthorizationGrantCache.getInstance().clearCacheEntryByCodeId(grantCacheKey, authzCodeDO.getAuthzCodeId());
// Remove authorization code from OAuthCache
OAuthCacheKey oauthCacheKey = new OAuthCacheKey(authzCodeDO.getAuthorizationCode());
CacheEntry oauthCacheEntry = OAuthCache.getInstance().getValueFromCache(oauthCacheKey);
if (oauthCacheEntry != null) {
OAuthCache.getInstance().clearCacheEntry(oauthCacheKey);
}
}
}
use of org.wso2.carbon.identity.oauth.cache.AuthorizationGrantCacheKey in project identity-inbound-auth-oauth by wso2-extensions.
the class AbstractTokenBinder method getTokenBindingValue.
@Override
public Optional<String> getTokenBindingValue(OAuth2AccessTokenReqDTO oAuth2AccessTokenReqDTO) {
if (AUTHORIZATION_CODE.equals(oAuth2AccessTokenReqDTO.getGrantType()) && StringUtils.isNotBlank(oAuth2AccessTokenReqDTO.getAuthorizationCode())) {
AuthorizationGrantCacheKey cacheKey = new AuthorizationGrantCacheKey(oAuth2AccessTokenReqDTO.getAuthorizationCode());
AuthorizationGrantCacheEntry authorizationGrantCacheEntry = AuthorizationGrantCache.getInstance().getValueFromCacheByCode(cacheKey);
if (authorizationGrantCacheEntry != null && StringUtils.isNotBlank(authorizationGrantCacheEntry.getTokenBindingValue())) {
return Optional.of(authorizationGrantCacheEntry.getTokenBindingValue());
}
}
return Optional.empty();
}
Aggregations