org.wso2.carbon.identity.event.event.Event.getEventName()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(12.6k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.wso2.carbon.identity.event.event.Event.getEventName()方法的一些代码示例,展示了Event.getEventName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.getEventName()方法的具体详情如下:
包路径:org.wso2.carbon.identity.event.event.Event
类名称:Event
方法名:getEventName

Event.getEventName介绍

暂无

代码示例

代码示例来源:origin: org.wso2.carbon.identity.governance/org.wso2.carbon.identity.recovery

public boolean canHandle(MessageContext messageContext) throws IdentityRuntimeException {
  Event event = ((IdentityEventMessageContext) messageContext).getEvent();
  String eventName = event.getEventName();
  if (IdentityEventConstants.Event.POST_DELETE_USER.equals(eventName)) {
    return true;
  }
  return false;
}

代码示例来源:origin: org.wso2.carbon.identity.framework/org.wso2.carbon.identity.event

@Override
  public void run() {
    if (log.isDebugEnabled()) {
      log.debug("Executing " + module.getName() + " on event" + event.
          getEventName());
    }
    try {
      module.handleEvent(event);
    } catch (IdentityEventException e) {
      log.error("Error while invoking notification sending module " + module.
          getName(), e);
    }
  }
};

代码示例来源:origin: org.wso2.carbon.identity.governance/org.wso2.carbon.identity.recovery

@Override
public void handleEvent(Event event) throws IdentityEventException {
  String eventName = event.getEventName();
  if (log.isDebugEnabled()) {
    log.debug("Handling event : " + eventName);//
  }
  Map<String, Object> eventProperties = event.getEventProperties();
  UserStoreManager userStoreManager = (UserStoreManager) eventProperties.get(IdentityEventConstants
      .EventProperty.USER_STORE_MANAGER);
  if (IdentityEventConstants.Event.PRE_SET_USER_CLAIMS.equals(eventName)) {
    handleClaimUpdate(eventProperties, userStoreManager);
  }
  if (IdentityEventConstants.Event.PRE_AUTHENTICATION.equals(eventName)) {
    handleAuthenticate(eventProperties, userStoreManager);
  }
}

代码示例来源:origin: org.wso2.carbon.identity.governance/org.wso2.carbon.identity.account.suspension.notification.task

@Override
public void handleEvent(Event event) throws IdentityEventException {
  boolean isEnabled = isSuspensionNotificationEnabled(event);
  if (!isEnabled) {
    return;
  }
  if (IdentityEventConstants.Event.POST_AUTHENTICATION.equals(event.getEventName())) {
    Map<String, Object> eventProperties = event.getEventProperties();
    String userName = (String) eventProperties.get(IdentityEventConstants.EventProperty.USER_NAME);
    UserStoreManager userStoreManager = (UserStoreManager) eventProperties
        .get(IdentityEventConstants.EventProperty.USER_STORE_MANAGER);
    if (!(Boolean) eventProperties.get(IdentityEventConstants.EventProperty.OPERATION_STATUS)) {
      return;
    }
    try {
      HashMap<String, String> userClaims = new HashMap<>();
      userClaims.put(NotificationConstants.LAST_LOGIN_TIME, Long.toString(System.currentTimeMillis()));
      userStoreManager.setUserClaimValues(userName, userClaims, null);
    } catch (UserStoreException e) {
      log.error("Error occurred while updating last login claim for user: ", e);
    }
  }
}

代码示例来源:origin: wso2/carbon-identity-framework

@Override
  public void run() {
    if (log.isDebugEnabled()) {
      log.debug("Executing " + module.getName() + " on event" + event.
          getEventName());
    }
    try {
      module.handleEvent(event);
    } catch (IdentityEventException e) {
      log.error("Error while invoking notification sending module " + module.
          getName(), e);
    }
  }
};

代码示例来源:origin: org.wso2.carbon.identity.data.publisher.audit/org.wso2.carbon.identity.data.publisher.audit.user.operation

@Override
public void handleEvent(Event event) throws IdentityEventException {
  switch (event.getEventName()) {
    case IdentityEventConstants.Event.POST_ADD_USER:
      handleAddUser(event);
      break;
    case IdentityEventConstants.Event.POST_DELETE_USER:
      handleDeleteUser(event);
      break;
    case IdentityEventConstants.Event.POST_UPDATE_CREDENTIAL:
    case IdentityEventConstants.Event.POST_UPDATE_CREDENTIAL_BY_ADMIN:
      handleUpdateCredential(event);
      break;
    case IdentityEventConstants.Event.POST_SET_USER_CLAIMS:
      handleSetUserClaims(event);
      break;
    default:
      if (log.isDebugEnabled()) {
        log.debug("Ignored unsupported event " + event.getEventName());
      }
  }
}

代码示例来源:origin: org.wso2.carbon.identity.governance/org.wso2.carbon.identity.captcha

@Override
public void handleEvent(Event event) throws IdentityEventException {
  boolean isEnabled = isFailLoginAttemptValidatorEnabled(event);
  if (!isEnabled) {
    return;
  }
  if (event.getEventProperties().get(EventProperty.CONTEXT) instanceof AuthenticationContext &&
      event.getEventProperties().get(EventProperty.PARAMS) instanceof Map) {
    AuthenticationContext context = (AuthenticationContext) event.getEventProperties().get(EventProperty.CONTEXT);
    Map<String, Object> unmodifiableParamMap = (Map<String, Object>) event.getEventProperties()
        .get(EventProperty.PARAMS);
    String eventName = event.getEventName();
    if (EventName.AUTHENTICATION_STEP_FAILURE.name().equals(eventName)) {
      publishAuthenticationStepFailure(context, unmodifiableParamMap);
      if (log.isDebugEnabled() && event != null) {
        log.debug(this.getName() + " received event : " + event.getEventName());
      }
    }
  }
}

代码示例来源:origin: wso2/carbon-identity-framework

public boolean canHandle(MessageContext messageContext) throws IdentityRuntimeException {
  Event event = ((IdentityEventMessageContext) messageContext).getEvent();
  String eventName = event.getEventName();
  List<Subscription> subscriptionList = null;
  if (configs != null) {
    subscriptionList = configs.getSubscriptions();
  } else {
    return false;
  }
  if (subscriptionList != null) {
    for (Subscription subscription : subscriptionList) {
      if (subscription.getSubscriptionName().equals(eventName)) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: org.wso2.carbon.identity.framework/org.wso2.carbon.identity.event

public boolean canHandle(MessageContext messageContext) throws IdentityRuntimeException {
  Event event = ((IdentityEventMessageContext) messageContext).getEvent();
  String eventName = event.getEventName();
  List<Subscription> subscriptionList = null;
  if (configs != null) {
    subscriptionList = configs.getSubscriptions();
  } else {
    return false;
  }
  if (subscriptionList != null) {
    for (Subscription subscription : subscriptionList) {
      if (subscription.getSubscriptionName().equals(eventName)) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.handler.event.account.lock

@Override
public void handleEvent(Event event) throws IdentityEventException {
  IdentityUtil.clearIdentityErrorMsg();
  Map<String, Object> eventProperties = event.getEventProperties();
  String userName = (String) eventProperties.get(IdentityEventConstants.EventProperty.USER_NAME);
  UserStoreManager userStoreManager = (UserStoreManager) eventProperties.get(IdentityEventConstants.EventProperty
      .USER_STORE_MANAGER);
  String userStoreDomainName = AccountUtil.getUserStoreDomainName(userStoreManager);
  String tenantDomain = (String) eventProperties.get(IdentityEventConstants.EventProperty.TENANT_DOMAIN);
  String usernameWithDomain = UserCoreUtil.addDomainToName(userName, userStoreDomainName);
  boolean userExists;
  try {
    userExists = userStoreManager.isExistingUser(usernameWithDomain);
  } catch (UserStoreException e) {
    throw new IdentityEventException("Error in accessing user store");
  }
  if (!userExists) {
    return;
  }
  if (IdentityEventConstants.Event.PRE_AUTHENTICATION.equals(event.getEventName())) {
    handlePreAuthentication(event, userName, userStoreManager, userStoreDomainName, tenantDomain);
  } else if (IdentityEventConstants.Event.PRE_SET_USER_CLAIMS.equals(event.getEventName())) {
    handlePreSetUserClaimValues(event, userName, userStoreManager, userStoreDomainName, tenantDomain);
  } else if (IdentityEventConstants.Event.POST_SET_USER_CLAIMS.equals(event.getEventName())) {
    handlePostSetUserClaimValues(event, userName, userStoreManager, userStoreDomainName, tenantDomain);
  }
}

代码示例来源:origin: org.wso2.carbon.identity.event.handler.accountlock/org.wso2.carbon.identity.handler.event.account.lock

if (IdentityEventConstants.Event.PRE_AUTHENTICATION.equals(event.getEventName())) {
  handlePreAuthentication(event, userName, userStoreManager, userStoreDomainName, tenantDomain);
} else if (IdentityEventConstants.Event.PRE_SET_USER_CLAIMS.equals(event.getEventName())) {
  handlePreSetUserClaimValues(event, userName, userStoreManager, userStoreDomainName, tenantDomain);
} else if (IdentityEventConstants.Event.POST_SET_USER_CLAIMS.equals(event.getEventName())) {
  handlePostSetUserClaimValues(event, userName, userStoreManager, userStoreDomainName, tenantDomain);

代码示例来源:origin: org.wso2.carbon.identity.governance/org.wso2.carbon.identity.recovery

@Override
public void handleEvent(Event event) throws IdentityEventException {
  String eventName = event.getEventName();
  if (log.isDebugEnabled()) {
    log.debug("Handling event : " + eventName);
  }
  if (IdentityEventConstants.Event.POST_DELETE_USER.equals(event.getEventName())) {
    UserRecoveryDataStore userRecoveryDataStore = JDBCRecoveryDataStore.getInstance();
    Map<String, Object> eventProperties = event.getEventProperties();
    String userName = (String) eventProperties.get(IdentityEventConstants.EventProperty.USER_NAME);
    UserStoreManager userStoreManager = (UserStoreManager) eventProperties.get(IdentityEventConstants.
        EventProperty.USER_STORE_MANAGER);
    String tenantDomain = (String) eventProperties.get(IdentityEventConstants.EventProperty.TENANT_DOMAIN);
    String domainName = userStoreManager.getRealmConfiguration().getUserStoreProperty(UserCoreConstants.
        RealmConfig.PROPERTY_DOMAIN_NAME);
    User user = new User();
    user.setUserName(userName);
    user.setTenantDomain(tenantDomain);
    user.setUserStoreDomain(domainName);
    try {
      userRecoveryDataStore.invalidate(user);
    } catch (IdentityRecoveryException e) {
      throw new IdentityEventException("Error while invalidating codes.", e);
    }
  }
}

代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.oauth2/org.wso2.carbon.identity.oauth

String eventName = event.getEventName();
try {
  String tokenState = (String) eventProperties.get(OIDCConstants.Event.TOKEN_STATE);

代码示例来源:origin: org.wso2.carbon.identity.framework/org.wso2.carbon.identity.consent.mgt

if (!isEnabled(eventContext)) {
  if (log.isDebugEnabled()) {
    log.debug("ConsentDeletionUserEventHandler is disabled. Not handling the " + event.getEventName()
        + " event.");

代码示例来源:origin: wso2/carbon-identity-framework

if (!isEnabled(eventContext)) {
  if (log.isDebugEnabled()) {
    log.debug("ConsentDeletionUserEventHandler is disabled. Not handling the " + event.getEventName()
        + " event.");

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.handler.event.account.lock

if (IdentityEventConstants.Event.PRE_AUTHENTICATION.equals(event.getEventName())) {
  handlePreAuthentication(event, userName, userStoreManager, userStoreDomainName, tenantDomain,
      identityProperties, maximumFailedAttempts, accountLockTime, unlockTimeRatio);
} else if (IdentityEventConstants.Event.POST_AUTHENTICATION.equals(event.getEventName())) {
  handlePostAuthentication(event, userName, userStoreManager, userStoreDomainName, tenantDomain,
      identityProperties, maximumFailedAttempts, accountLockTime, unlockTimeRatio);
} else if (IdentityEventConstants.Event.PRE_SET_USER_CLAIMS.equals(event.getEventName())) {
  handlePreSetUserClaimValues(event, userName, userStoreManager, userStoreDomainName, tenantDomain,
      identityProperties, maximumFailedAttempts, accountLockTime, unlockTimeRatio);
} else if (IdentityEventConstants.Event.POST_SET_USER_CLAIMS.equals(event.getEventName())) {
  handlePostSetUserClaimValues(event, userName, userStoreManager, userStoreDomainName, tenantDomain,
      identityProperties, maximumFailedAttempts, accountLockTime, unlockTimeRatio);

代码示例来源:origin: org.wso2.carbon.identity.framework/org.wso2.carbon.identity.event

@Override
  public void handleEvent(Event event) throws IdentityEventException {

    List<AbstractEventHandler> eventHandlerList = IdentityEventServiceComponent.eventHandlerList;
    IdentityEventMessageContext eventContext = new IdentityEventMessageContext(event);
    for (final AbstractEventHandler handler : eventHandlerList) {

      if (handler.canHandle(eventContext)) {
        if (handler.isAssociationAsync(event.getEventName())) {
          eventDistributionTask.addEventToQueue(event);
        } else {
          handler.handleEvent(event);
        }
      }
    }
  }
}

代码示例来源:origin: wso2/carbon-identity-framework

@Override
  public void handleEvent(Event event) throws IdentityEventException {

    List<AbstractEventHandler> eventHandlerList = IdentityEventServiceComponent.eventHandlerList;
    IdentityEventMessageContext eventContext = new IdentityEventMessageContext(event);
    for (final AbstractEventHandler handler : eventHandlerList) {

      if (handler.canHandle(eventContext)) {
        if (handler.isAssociationAsync(event.getEventName())) {
          eventDistributionTask.addEventToQueue(event);
        } else {
          handler.handleEvent(event);
        }
      }
    }
  }
}

代码示例来源:origin: org.wso2.carbon.identity.governance/org.wso2.carbon.identity.recovery

if (IdentityEventConstants.Event.PRE_AUTHENTICATION.equals(event.getEventName())) {
    if(log.isDebugEnabled()){
      log.debug("PreAuthenticate");

代码示例来源:origin: org.wso2.carbon.identity.data.publisher.audit/org.wso2.carbon.identity.data.publisher.audit.user.operation

userData.setAction(event.getEventName());
userData.setUsername((String) event.getEventProperties().get(IdentityEventConstants.EventProperty.USER_NAME));

相关文章