Search in sources :

Example 1 with CommonProfileDefinition

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

the class RestAuthenticator method internalInit.

@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);
    }
}
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) 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) RestProfile(org.pac4j.http.profile.RestProfile) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 2 with CommonProfileDefinition

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

the class InMemoryProfileService method internalInit.

@Override
protected void internalInit(final boolean forceReinit) {
    assertNotNull("passwordEncoder", getPasswordEncoder());
    defaultProfileDefinition(new CommonProfileDefinition(profileFactory));
    setSerializer(new JsonSerializer(CommonProfile.class));
    super.internalInit(forceReinit);
}
Also used : CommonProfile(org.pac4j.core.profile.CommonProfile) JsonSerializer(org.pac4j.core.util.serializer.JsonSerializer) CommonProfileDefinition(org.pac4j.core.profile.definition.CommonProfileDefinition)

Example 3 with CommonProfileDefinition

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

the class IpRegexpAuthenticator method internalInit.

@Override
protected void internalInit(final boolean forceReinit) {
    CommonHelper.assertNotNull("pattern", pattern);
    defaultProfileDefinition(new CommonProfileDefinition(x -> new IpProfile()));
}
Also used : WebContext(org.pac4j.core.context.WebContext) CredentialsException(org.pac4j.core.exception.CredentialsException) CommonProfileDefinition(org.pac4j.core.profile.definition.CommonProfileDefinition) Authenticator(org.pac4j.core.credentials.authenticator.Authenticator) CommonHelper(org.pac4j.core.util.CommonHelper) Credentials(org.pac4j.core.credentials.Credentials) SessionStore(org.pac4j.core.context.session.SessionStore) TokenCredentials(org.pac4j.core.credentials.TokenCredentials) IpProfile(org.pac4j.http.profile.IpProfile) IpProfile(org.pac4j.http.profile.IpProfile) CommonProfileDefinition(org.pac4j.core.profile.definition.CommonProfileDefinition)

Example 4 with CommonProfileDefinition

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

the class DbProfileService method internalInit.

@Override
protected void internalInit(final boolean forceReinit) {
    assertNotNull("passwordEncoder", getPasswordEncoder());
    assertNotNull("dataSource", this.dataSource);
    this.dbi = new DBI(this.dataSource);
    defaultProfileDefinition(new CommonProfileDefinition(x -> new DbProfile()));
    setSerializer(new JsonSerializer(DbProfile.class));
    super.internalInit(forceReinit);
}
Also used : AbstractProfileService(org.pac4j.core.profile.service.AbstractProfileService) List(java.util.List) Handle(org.skife.jdbi.v2.Handle) PasswordEncoder(org.pac4j.core.credentials.password.PasswordEncoder) CommonProfileDefinition(org.pac4j.core.profile.definition.CommonProfileDefinition) DbProfile(org.pac4j.sql.profile.DbProfile) DBI(org.skife.jdbi.v2.DBI) Map(java.util.Map) DataSource(javax.sql.DataSource) CommonHelper(org.pac4j.core.util.CommonHelper) JsonSerializer(org.pac4j.core.util.serializer.JsonSerializer) ArrayList(java.util.ArrayList) DBI(org.skife.jdbi.v2.DBI) JsonSerializer(org.pac4j.core.util.serializer.JsonSerializer) DbProfile(org.pac4j.sql.profile.DbProfile) CommonProfileDefinition(org.pac4j.core.profile.definition.CommonProfileDefinition)

Example 5 with CommonProfileDefinition

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

the class DbProfileService method internalInit.

@Override
protected void internalInit() {
    CommonHelper.assertNotNull("passwordEncoder", getPasswordEncoder());
    defaultProfileDefinition(new CommonProfileDefinition<>(x -> new DbProfile()));
    CommonHelper.assertNotNull("dataSource", this.dataSource);
    this.dbi = new DBI(this.dataSource);
    super.internalInit();
}
Also used : AbstractProfileService(org.pac4j.core.profile.service.AbstractProfileService) List(java.util.List) Handle(org.skife.jdbi.v2.Handle) PasswordEncoder(org.pac4j.core.credentials.password.PasswordEncoder) CommonProfileDefinition(org.pac4j.core.profile.definition.CommonProfileDefinition) DbProfile(org.pac4j.sql.profile.DbProfile) DBI(org.skife.jdbi.v2.DBI) Map(java.util.Map) DataSource(javax.sql.DataSource) CommonHelper(org.pac4j.core.util.CommonHelper) ArrayList(java.util.ArrayList) DBI(org.skife.jdbi.v2.DBI) DbProfile(org.pac4j.sql.profile.DbProfile)

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