@Override protected void internalInit() { CommonHelper.assertNotBlank("url", url); defaultProfileDefinition(new CommonProfileDefinition<>(x -> new RestProfile())); if (mapper == null) { mapper = new ObjectMapper(); mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); } }
protected StormpathProfile createProfile(final Account account) { final StormpathProfile profile = getProfileDefinition().newProfile(); profile.setId(account.getUsername()); getProfileDefinition().convertAndAdd(profile, StormpathProfileDefinition.FULL_NAME, account.getFullName()); getProfileDefinition().convertAndAdd(profile, CommonProfileDefinition.EMAIL, account.getEmail()); getProfileDefinition().convertAndAdd(profile, StormpathProfileDefinition.GIVEN_NAME, account.getGivenName()); getProfileDefinition().convertAndAdd(profile, StormpathProfileDefinition.MIDDLE_NAME, account.getMiddleName()); getProfileDefinition().convertAndAdd(profile, StormpathProfileDefinition.SUR_NAME, account.getSurname()); getProfileDefinition().convertAndAdd(profile, StormpathProfileDefinition.GROUPS, account.getGroups()); getProfileDefinition().convertAndAdd(profile, StormpathProfileDefinition.GROUP_MEMBERSHIPS, account.getGroupMemberships()); getProfileDefinition().convertAndAdd(profile, StormpathProfileDefinition.STATUS, account.getStatus()); return profile; }
protected void buildProfile(final UsernamePasswordCredentials credentials, final String body) { final RestProfile profileClass = getProfileDefinition().newProfile(); final RestProfile profile; try { profile = mapper.readValue(body, profileClass.getClass()); } catch (final IOException e) { throw new TechnicalException(e); } logger.debug("profile: {}", profile); credentials.setUserProfile(profile); }
@Override protected void internalInit() { defaultProfileDefinition(new CommonProfileDefinition<>(x -> new SAML2Profile())); }
@Override protected void clientInit() { service = UserServiceFactory.getUserService(); CommonHelper.assertNotNull("service", this.service); defaultRedirectActionBuilder(ctx -> { final String destinationUrl = computeFinalCallbackUrl(ctx); final String loginUrl = authDomain == null ? service.createLoginURL(destinationUrl) : service.createLoginURL(destinationUrl, authDomain); return RedirectAction.redirect(loginUrl); }); defaultCredentialsExtractor(ctx -> { final GaeUserCredentials credentials = new GaeUserCredentials(); credentials.setUser(service.getCurrentUser()); return credentials; }); defaultAuthenticator((credentials, ctx) -> { final User user = credentials.getUser(); if (user != null) { final GaeUserServiceProfile profile = PROFILE_DEFINITION.newProfile(); profile.setId(user.getEmail()); PROFILE_DEFINITION.convertAndAdd(profile, PROFILE_ATTRIBUTE, CommonProfileDefinition.EMAIL, user.getEmail()); PROFILE_DEFINITION.convertAndAdd(profile, PROFILE_ATTRIBUTE, CommonProfileDefinition.DISPLAY_NAME, user.getNickname()); if (service.isUserAdmin()) { profile.addRole(GaeUserServiceProfile.PAC4J_GAE_GLOBAL_ADMIN_ROLE); } credentials.setUserProfile(profile); } }); }
@Override public void validate(final TokenCredentials credentials, final WebContext context) { init(); final String ip = credentials.getToken(); if (!this.pattern.matcher(ip).matches()) { throw new CredentialsException("Unauthorized IP address: " + ip); } final IpProfile profile = getProfileDefinition().newProfile(); profile.setId(ip); logger.debug("profile: {}", profile); credentials.setUserProfile(profile); } }
@Override protected void internalInit() { defaultProfileDefinition(new CommonProfileDefinition<>(x -> new X509Profile())); }
init(); final SAML2Profile profile = getProfileDefinition().newProfile(); final String newName = mappedAttributes.get(name); logger.debug("Mapping attribute {} as {} with values {} to profile", name, newName, values); getProfileDefinition().convertAndAdd(profile, PROFILE_ATTRIBUTE, newName, values); } else { logger.debug("Adding attribute {} to profile with values {}", name, values); getProfileDefinition().convertAndAdd(profile, PROFILE_ATTRIBUTE, name, values); getProfileDefinition().convertAndAdd(profile, PROFILE_ATTRIBUTE, friendlyName, values);
final X509Profile profile = getProfileDefinition().newProfile(); profile.setId(id); logger.debug("profile: {}", profile);
@Override protected void internalInit() { assertNotBlank("realmName", this.realmName); defaultProfileDefinition(new CommonProfileDefinition<>(x -> new JwtProfile())); if (signatureConfigurations.isEmpty()) { logger.warn("No signature configurations have been defined: non-signed JWT will be accepted!"); } }
final U profile = getProfileDefinition().newProfile(); profile.setAccessToken(accessToken); final JWT idToken = credentials.getIdToken(); userInfoClaimsSet = userInfoSuccessResponse.getUserInfoJWT().getJWTClaimsSet(); getProfileDefinition().convertAndAdd(profile, userInfoClaimsSet.getClaims(), null); getProfileDefinition().convertAndAdd(profile, PROFILE_ATTRIBUTE, key, value);
@Override protected void internalInit() { CommonHelper.assertNotNull("pattern", pattern); defaultProfileDefinition(new CommonProfileDefinition<>(x -> new IpProfile())); }
@Override protected void internalInit() { CommonHelper.assertNotNull("passwordEncoder", getPasswordEncoder()); CommonHelper.assertNotNull("couchDbConnector", this.couchDbConnector); defaultProfileDefinition(new CommonProfileDefinition<>(x -> new CouchProfile())); super.internalInit(); }
@Override protected void internalInit() { CommonHelper.assertNotNull("passwordEncoder", getPasswordEncoder()); CommonHelper.assertNotNull("mongoClient", this.mongoClient); CommonHelper.assertNotBlank("usersDatabase", this.usersDatabase); CommonHelper.assertNotBlank("usersCollection", this.usersCollection); defaultProfileDefinition(new CommonProfileDefinition<>(x -> new MongoProfile())); super.internalInit(); }
@Override protected void internalInit() { CommonHelper.assertNotNull("ldapAuthenticator", ldapAuthenticator); CommonHelper.assertNotNull("connectionFactory", connectionFactory); CommonHelper.assertNull("passwordEncoder", getPasswordEncoder()); CommonHelper.assertNotBlank("usersDn", usersDn); defaultProfileDefinition(new CommonProfileDefinition<>(x -> new LdapProfile())); super.internalInit(); }
@Override protected void internalInit(final WebContext context) { CommonHelper.assertNotBlank("accessId", accessId); CommonHelper.assertNotBlank("secretKey", secretKey); CommonHelper.assertNotBlank("applicationId", applicationId); try { final Client client = new Client(new DefaultApiKey(accessId, secretKey)); this.application = client.getDataStore().getResource( String.format("/applications/%s", applicationId), Application.class); } catch (final Exception e) { throw new TechnicalException("An exception is caught trying to access Stormpath cloud. " + "Please verify that your provided Stormpath <accessId>, " + "<secretKey>, and <applicationId> are correct.", e); } defaultProfileDefinition(new CommonProfileDefinition<>(x -> new StormpathProfile())); }