@EventListener public void onUserAttributeStore(final UserAttributeStoredEvent event) { checkArgument(event != null, "Expecting event to be non-null"); checkArgument(event.getUser() != null, "Expecting event to contain a non-null user"); if (isFirstLogin(event) && licenseService.hasActiveSoftwareLicense()) { firstLoginHandler.onFirstLogin(event.getUser().getName()); } }
private Set<String> getAttributeValues( final UserAttributeStoredEvent event, String attributeKey) { final Set<String> attributeKeys = event.getAttributeNames(); // Unfortunately this is required due to the way UserAttributeStoredEvent implements // getAttributeValues. // It does a map look up and wrap the result around Collections.unmodifiableSet without checking // for null. return attributeKeys.contains(attributeKey) ? event.getAttributeValues(attributeKey) : emptySet(); }