Search in sources :

Example 11 with OAuthEventInterceptor

use of org.wso2.carbon.identity.oauth.event.OAuthEventInterceptor in project identity-inbound-auth-oauth by wso2-extensions.

the class ResponseTypeHandlerUtil method triggerPostListeners.

public static void triggerPostListeners(OAuthAuthzReqMessageContext oauthAuthzMsgCtx, AccessTokenDO tokenDO, OAuth2AuthorizeRespDTO respDTO) {
    OAuthEventInterceptor oAuthEventInterceptorProxy = OAuthComponentServiceHolder.getInstance().getOAuthEventInterceptorProxy();
    if (oAuthEventInterceptorProxy != null && oAuthEventInterceptorProxy.isEnabled()) {
        try {
            Map<String, Object> paramMap = new HashMap<>();
            oAuthEventInterceptorProxy.onPostTokenIssue(oauthAuthzMsgCtx, tokenDO, respDTO, paramMap);
            if (log.isDebugEnabled()) {
                log.debug("Oauth post token issue listener is triggered.");
            }
        } catch (IdentityOAuth2Exception e) {
            log.error("Oauth post token issue listener ", e);
        }
    }
}
Also used : IdentityOAuth2Exception(org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception) HashMap(java.util.HashMap) OAuthEventInterceptor(org.wso2.carbon.identity.oauth.event.OAuthEventInterceptor)

Example 12 with OAuthEventInterceptor

use of org.wso2.carbon.identity.oauth.event.OAuthEventInterceptor in project identity-inbound-auth-oauth by wso2-extensions.

the class OAuthAdminServiceImpl method triggerPreRevokeListeners.

void triggerPreRevokeListeners(OAuthRevocationRequestDTO revokeRequestDTO) throws IdentityOAuthAdminException {
    OAuthEventInterceptor oAuthEventInterceptorProxy = OAuthComponentServiceHolder.getInstance().getOAuthEventInterceptorProxy();
    if (oAuthEventInterceptorProxy != null && oAuthEventInterceptorProxy.isEnabled()) {
        try {
            Map<String, Object> paramMap = new HashMap<String, Object>();
            oAuthEventInterceptorProxy.onPreTokenRevocationByResourceOwner(revokeRequestDTO, paramMap);
        } catch (IdentityOAuth2Exception e) {
            throw handleError("Error occurred with Oauth pre-revoke listener ", e);
        }
    }
}
Also used : IdentityOAuth2Exception(org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception) HashMap(java.util.HashMap) OAuth2Util.buildScopeString(org.wso2.carbon.identity.oauth2.util.OAuth2Util.buildScopeString) OAuthEventInterceptor(org.wso2.carbon.identity.oauth.event.OAuthEventInterceptor)

Aggregations

OAuthEventInterceptor (org.wso2.carbon.identity.oauth.event.OAuthEventInterceptor)12 HashMap (java.util.HashMap)11 IdentityOAuth2Exception (org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception)7 AccessTokenDO (org.wso2.carbon.identity.oauth2.model.AccessTokenDO)3 IdentityException (org.wso2.carbon.identity.base.IdentityException)2 InvalidOAuthClientException (org.wso2.carbon.identity.oauth.common.exception.InvalidOAuthClientException)2 OAuth2Util.buildScopeString (org.wso2.carbon.identity.oauth2.util.OAuth2Util.buildScopeString)2 JWEObject (com.nimbusds.jose.JWEObject)1 Timestamp (java.sql.Timestamp)1 Date (java.util.Date)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 OAuthSystemException (org.apache.oltu.oauth2.common.exception.OAuthSystemException)1 JSONObject (org.json.JSONObject)1 BeforeTest (org.testng.annotations.BeforeTest)1 UserIdNotFoundException (org.wso2.carbon.identity.application.authentication.framework.exception.UserIdNotFoundException)1 OAuthCacheKey (org.wso2.carbon.identity.oauth.cache.OAuthCacheKey)1 OAuthAppDO (org.wso2.carbon.identity.oauth.dao.OAuthAppDO)1 OAuthClientAuthnContext (org.wso2.carbon.identity.oauth2.bean.OAuthClientAuthnContext)1 OAuth2AuthorizeReqDTO (org.wso2.carbon.identity.oauth2.dto.OAuth2AuthorizeReqDTO)1