Record Class ProviderAccount

java.lang.Object
java.lang.Record
org.jwcarman.who.oidc.ProviderAccount
Record Components:
registration - the registration it signed in through
subject - the account's identifier at the provider, stable for the life of the account
displayName - what to call the account on the confirm screen
verifiedEmail - the account's email, only when the provider is trusted for email and marks it verified
claims - the ID token's simple-valued claims (text, true/false and numbers), for the sign-up policy; empty for a provider that is not OpenID Connect

public record ProviderAccount(SignInRegistration registration, String subject, String displayName, Optional<String> verifiedEmail, Map<String,Object> claims) extends Record
The provider account a sign-in came back with.
  • Constructor Details

  • Method Details

    • from

      public static ProviderAccount from(org.springframework.security.oauth2.core.user.OAuth2User user, SignInRegistration registration)
      Reads the account from what Spring Security signed in.
      Parameters:
      user - the provider's user
      registration - the registration it signed in through
      Returns:
      the account
      Throws:
      IllegalStateException - when the provider did not return the subject attribute
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • registration

      public SignInRegistration registration()
      Returns the value of the registration record component.
      Returns:
      the value of the registration record component
    • subject

      public String subject()
      Returns the value of the subject record component.
      Returns:
      the value of the subject record component
    • displayName

      public String displayName()
      Returns the value of the displayName record component.
      Returns:
      the value of the displayName record component
    • verifiedEmail

      public Optional<String> verifiedEmail()
      Returns the value of the verifiedEmail record component.
      Returns:
      the value of the verifiedEmail record component
    • claims

      public Map<String,Object> claims()
      Returns the value of the claims record component.
      Returns:
      the value of the claims record component