Search in sources :

Example 6 with CommonProfileDefinition

use of org.pac4j.core.profile.definition.CommonProfileDefinition in project pac4j by pac4j.

the class RestAuthenticator method internalInit.

@Override
protected void internalInit(final boolean forceReinit) {
    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);
    }
}
Also used : UsernamePasswordCredentials(org.pac4j.core.credentials.UsernamePasswordCredentials) HttpURLConnection(java.net.HttpURLConnection) Logger(org.slf4j.Logger) JsonParser(com.fasterxml.jackson.core.JsonParser) URL(java.net.URL) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) LoggerFactory(org.slf4j.LoggerFactory) HttpConstants(org.pac4j.core.context.HttpConstants) IOException(java.io.IOException) HashMap(java.util.HashMap) ProfileDefinitionAware(org.pac4j.core.profile.definition.ProfileDefinitionAware) SessionStore(org.pac4j.core.context.session.SessionStore) DeserializationFeature(com.fasterxml.jackson.databind.DeserializationFeature) StandardCharsets(java.nio.charset.StandardCharsets) WebContext(org.pac4j.core.context.WebContext) Base64(java.util.Base64) CommonProfileDefinition(org.pac4j.core.profile.definition.CommonProfileDefinition) RestProfile(org.pac4j.http.profile.RestProfile) Map(java.util.Map) Authenticator(org.pac4j.core.credentials.authenticator.Authenticator) CommonHelper(org.pac4j.core.util.CommonHelper) HttpUtils(org.pac4j.core.util.HttpUtils) TechnicalException(org.pac4j.core.exception.TechnicalException) Credentials(org.pac4j.core.credentials.Credentials) RestProfile(org.pac4j.http.profile.RestProfile) CommonProfileDefinition(org.pac4j.core.profile.definition.CommonProfileDefinition) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 7 with CommonProfileDefinition

use of org.pac4j.core.profile.definition.CommonProfileDefinition in project pac4j by pac4j.

the class LdapProfileService method internalInit.

@Override
protected void internalInit(final boolean forceReinit) {
    assertNotNull("ldapAuthenticator", ldapAuthenticator);
    assertNotNull("connectionFactory", connectionFactory);
    assertNull("passwordEncoder", getPasswordEncoder());
    assertNotBlank("usersDn", usersDn);
    defaultProfileDefinition(new CommonProfileDefinition(x -> new LdapProfile()));
    setSerializer(new JsonSerializer(LdapProfile.class));
    super.internalInit(forceReinit);
}
Also used : UsernamePasswordCredentials(org.pac4j.core.credentials.UsernamePasswordCredentials) ResultPredicate(org.ldaptive.handler.ResultPredicate) AbstractProfileService(org.pac4j.core.profile.service.AbstractProfileService) java.util(java.util) org.pac4j.core.exception(org.pac4j.core.exception) SessionStore(org.pac4j.core.context.session.SessionStore) Pac4jConstants(org.pac4j.core.util.Pac4jConstants) JsonSerializer(org.pac4j.core.util.serializer.JsonSerializer) WebContext(org.pac4j.core.context.WebContext) LdapProfile(org.pac4j.ldap.profile.LdapProfile) CommonProfileDefinition(org.pac4j.core.profile.definition.CommonProfileDefinition) CommonHelper(org.pac4j.core.util.CommonHelper) Credentials(org.pac4j.core.credentials.Credentials) org.ldaptive(org.ldaptive) org.ldaptive.auth(org.ldaptive.auth) JsonSerializer(org.pac4j.core.util.serializer.JsonSerializer) LdapProfile(org.pac4j.ldap.profile.LdapProfile) CommonProfileDefinition(org.pac4j.core.profile.definition.CommonProfileDefinition)

Example 8 with CommonProfileDefinition

use of org.pac4j.core.profile.definition.CommonProfileDefinition in project pac4j by pac4j.

the class CouchProfileService method internalInit.

@Override
protected void internalInit(final boolean forceReinit) {
    assertNotNull("passwordEncoder", getPasswordEncoder());
    assertNotNull("couchDbConnector", this.couchDbConnector);
    defaultProfileDefinition(new CommonProfileDefinition(x -> new CouchProfile()));
    setSerializer(new JsonSerializer(CouchProfile.class));
    super.internalInit(forceReinit);
}
Also used : AbstractProfileService(org.pac4j.core.profile.service.AbstractProfileService) ViewQuery(org.ektorp.ViewQuery) CouchProfile(org.pac4j.couch.profile.CouchProfile) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) IOException(java.io.IOException) HashMap(java.util.HashMap) DocumentNotFoundException(org.ektorp.DocumentNotFoundException) JsonSerializer(org.pac4j.core.util.serializer.JsonSerializer) ArrayList(java.util.ArrayList) List(java.util.List) PasswordEncoder(org.pac4j.core.credentials.password.PasswordEncoder) CommonProfileDefinition(org.pac4j.core.profile.definition.CommonProfileDefinition) Map(java.util.Map) CommonHelper(org.pac4j.core.util.CommonHelper) TypeReference(com.fasterxml.jackson.core.type.TypeReference) CouchDbConnector(org.ektorp.CouchDbConnector) CouchProfile(org.pac4j.couch.profile.CouchProfile) JsonSerializer(org.pac4j.core.util.serializer.JsonSerializer) CommonProfileDefinition(org.pac4j.core.profile.definition.CommonProfileDefinition)

Example 9 with CommonProfileDefinition

use of org.pac4j.core.profile.definition.CommonProfileDefinition in project pac4j by pac4j.

the class MongoProfileService method internalInit.

@Override
protected void internalInit(final boolean forceReinit) {
    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()));
    setSerializer(new JsonSerializer(MongoProfile.class));
    super.internalInit(forceReinit);
}
Also used : Document(org.bson.Document) AbstractProfileService(org.pac4j.core.profile.service.AbstractProfileService) MongoClient(com.mongodb.client.MongoClient) MongoCollection(com.mongodb.client.MongoCollection) MongoProfile(org.pac4j.mongo.profile.MongoProfile) HashMap(java.util.HashMap) JsonSerializer(org.pac4j.core.util.serializer.JsonSerializer) ArrayList(java.util.ArrayList) Filters(com.mongodb.client.model.Filters) List(java.util.List) PasswordEncoder(org.pac4j.core.credentials.password.PasswordEncoder) CommonProfileDefinition(org.pac4j.core.profile.definition.CommonProfileDefinition) Map(java.util.Map) CommonHelper(org.pac4j.core.util.CommonHelper) JsonSerializer(org.pac4j.core.util.serializer.JsonSerializer) MongoProfile(org.pac4j.mongo.profile.MongoProfile) CommonProfileDefinition(org.pac4j.core.profile.definition.CommonProfileDefinition)

Aggregations

CommonProfileDefinition (org.pac4j.core.profile.definition.CommonProfileDefinition)9 CommonHelper (org.pac4j.core.util.CommonHelper)8 Map (java.util.Map)6 AbstractProfileService (org.pac4j.core.profile.service.AbstractProfileService)5 JsonSerializer (org.pac4j.core.util.serializer.JsonSerializer)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 List (java.util.List)4 WebContext (org.pac4j.core.context.WebContext)4 PasswordEncoder (org.pac4j.core.credentials.password.PasswordEncoder)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 IOException (java.io.IOException)3 SessionStore (org.pac4j.core.context.session.SessionStore)3 Credentials (org.pac4j.core.credentials.Credentials)3 UsernamePasswordCredentials (org.pac4j.core.credentials.UsernamePasswordCredentials)3 Authenticator (org.pac4j.core.credentials.authenticator.Authenticator)3 JsonParser (com.fasterxml.jackson.core.JsonParser)2 DeserializationFeature (com.fasterxml.jackson.databind.DeserializationFeature)2 HttpURLConnection (java.net.HttpURLConnection)2 URL (java.net.URL)2