Record Class SocialProperties
java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.api.web.social.SocialProperties
- Record Components:
providers- settings of each provider, by registration id (google,microsoft,apple,github).
@ConfigurationProperties("authserver.social")
public record SocialProperties(Map<String,SocialProperties.Provider> providers)
extends Record
Settings of the sign-in with external providers, bound once from
authserver.social.* and injected wherever
one is needed; an invalid value stops the application at startup. A provider is enabled when its
client-id has text: a blank one leaves the provider off, so the shipped application.yml can list all
of them with the values of environment variables and nothing is enabled until a deployment supplies them. Secrets
(the client secret, the Apple private key) are never kept in a committed file: they come from the environment only.
Whether a provider's own multi-factor authentication is trusted (trust-mfa) is per provider and off by
default: the sign-in is then a primary factor and the normal second-factor flow applies.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordSettings of one provider. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringTenant value of Entra ID that accepts work, school and personal accounts of any tenant.static final StringTenant value of Entra ID that accepts personal accounts only.static final DurationDefault lifetime of the client secret JWT sent to Apple.static final DurationLongest lifetime Apple accepts for a client secret: six months.static final StringTenant value of Entra ID that accepts work and school accounts of any tenant.private final Map<String, SocialProperties.Provider> The field for theprovidersrecord component.private static final PatternShape of a tenant id (a GUID): the issuer of a single-tenant token is built from it.private static final PatternCharacters a tenant (a GUID or a domain name) may contain: it becomes part of a URL. -
Constructor Summary
ConstructorsConstructorDescriptionSocialProperties(Map<String, SocialProperties.Provider> providers) Validates the settings and copies the map. -
Method Summary
Modifier and TypeMethodDescriptionReturns the enabled providers, in the order ofIdentityProvider.final booleanIndicates whether some other object is "equal to" this one.find(IdentityProvider provider) Returns the settings of an enabled provider.final inthashCode()Returns a hash code value for this object.Returns the value of theprovidersrecord component.private static voidRequires a setting to have text.final StringtoString()Returns a string representation of this record class.trust(IdentityProvider provider) Returns how far the multi-factor authentication of a provider is trusted.private static voidvalidate(IdentityProvider id, SocialProperties.Provider provider) Checks the settings of a provider that is enabled.
-
Field Details
-
providers
The field for theprovidersrecord component. -
COMMON_TENANT
Tenant value of Entra ID that accepts work, school and personal accounts of any tenant.- See Also:
-
ORGANIZATIONS_TENANT
Tenant value of Entra ID that accepts work and school accounts of any tenant.- See Also:
-
CONSUMERS_TENANT
Tenant value of Entra ID that accepts personal accounts only.- See Also:
-
MAX_APPLE_CLIENT_SECRET_TTL
Longest lifetime Apple accepts for a client secret: six months. -
DEFAULT_APPLE_CLIENT_SECRET_TTL
Default lifetime of the client secret JWT sent to Apple. -
TENANT_ID_PATTERN
Shape of a tenant id (a GUID): the issuer of a single-tenant token is built from it. -
TENANT_PATTERN
Characters a tenant (a GUID or a domain name) may contain: it becomes part of a URL.
-
-
Constructor Details
-
SocialProperties
Validates the settings and copies the map.- Throws:
IllegalArgumentException- if a key is not the registration id of a known provider, or an enabled provider lacks a setting it needs or has an invalid one.
-
-
Method Details
-
enabledProviders
Returns the enabled providers, in the order ofIdentityProvider.- Returns:
- the enabled providers and their settings; empty when none is configured.
-
find
Returns the settings of an enabled provider.- Parameters:
provider- the provider.- Returns:
- its settings, or an empty optional when it is not enabled.
-
trust
Returns how far the multi-factor authentication of a provider is trusted.- Parameters:
provider- the provider.- Returns:
- the trust setting; the provider is not trusted when it is not enabled.
-
validate
Checks the settings of a provider that is enabled.- Parameters:
id- the provider.provider- its settings.
-
require
Requires a setting to have text.- Parameters:
value- value of the setting.name- full name of the setting, for the message.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
providers
Returns the value of theprovidersrecord component.- Returns:
- the value of the
providersrecord component
-