use of org.wso2.carbon.identity.openidconnect.handlers.RequestObjectHandler in project identity-inbound-auth-oauth by wso2-extensions.
the class RequestObjectHandler method handleEvent.
/**
* Handles the event and invoke RequestObjectPersistenceFactory.
*
* @param event event
* @throws IdentityEventException
*/
@Override
public void handleEvent(Event event) throws IdentityEventException {
Map<String, Object> eventProperties = event.getEventProperties();
String eventName = event.getEventName();
boolean isRequestObjectEnabled = OAuthServerConfiguration.getInstance().isRequestObjectEnabled();
if (!isRequestObjectEnabled) {
log.debug("Request Object Flow is disabled, hence dropping the event");
return;
}
try {
Object isRequestObject = eventProperties.get(OIDCConstants.Event.IS_REQUEST_OBJECT_FLOW);
if (isRequestObject != null && !(boolean) isRequestObject) {
if (log.isDebugEnabled()) {
log.debug("The request does not contains request object. So skipping RequestObjectHandler");
}
return;
}
String tokenState = (String) eventProperties.get(OIDCConstants.Event.TOKEN_STATE);
String sessionDataKey = (String) eventProperties.get(OIDCConstants.Event.SESSION_DATA_KEY);
if (OIDCConstants.Event.POST_REVOKE_ACESS_TOKEN.equals(eventName)) {
handlePostRevokeToken(eventProperties, tokenState);
} else if (OIDCConstants.Event.POST_REVOKE_CODE.equals(eventName)) {
handlePostRevokeCode(eventProperties, tokenState);
} else if (OIDCConstants.Event.POST_REVOKE_CODE_BY_ID.equals(eventName)) {
revokeCodeById(eventProperties, tokenState);
} else if (OIDCConstants.Event.POST_REVOKE_ACESS_TOKEN_BY_ID.equals(eventName)) {
postRevokeTokenById(eventProperties, tokenState);
} else if (OIDCConstants.Event.POST_REFRESH_TOKEN.equals(eventName)) {
postRefreshToken(eventProperties);
} else if (OIDCConstants.Event.POST_ISSUE_CODE.equals(eventName)) {
postIssueCode(eventProperties, sessionDataKey);
} else if (OIDCConstants.Event.POST_ISSUE_ACCESS_TOKEN.equals(eventName)) {
postIssueTOken(eventProperties, sessionDataKey);
}
} catch (IdentityOAuth2Exception | IdentityOAuthAdminException e) {
String errorMsg = "Error while handling event: " + eventName;
log.info(errorMsg);
throw new IdentityEventException(errorMsg, e.getMessage());
}
}
use of org.wso2.carbon.identity.openidconnect.handlers.RequestObjectHandler in project identity-inbound-auth-oauth by wso2-extensions.
the class OpenIDConnectServiceComponent method activate.
protected void activate(ComponentContext context) {
try {
bundleContext = context.getBundleContext();
bundleContext.registerService(ClaimProvider.class.getName(), new OpenIDConnectSystemClaimImpl(), null);
bundleContext.registerService(AbstractEventHandler.class.getName(), new RequestObjectHandler(), null);
bundleContext.registerService(RequestObjectService.class.getName(), new RequestObjectService(), null);
bundleContext.registerService(AbstractEventHandler.class.getName(), new OIDCClaimMetaDataOperationHandler(), null);
} catch (Throwable e) {
String errMsg = "Error while activating OpenIDConnectServiceComponent.";
log.error(errMsg, e);
throw new RuntimeException(errMsg, e);
}
}
Aggregations