Class SessionUserDtoMapper

java.lang.Object
com.irurueta.authserver.bff.api.web.user.SessionUserDtoMapper

@Component public class SessionUserDtoMapper extends Object
Maps the OpenID Connect user of the BFF session onto the DTO generated from the contract. The BFF has no domain yet, so the source is the Spring Security principal; only UI-safe claims are ever exposed, never a token.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final String
    ID token claim holding the roles of the user, as issued by the authorization server.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static String
    displayName(org.springframework.security.oauth2.core.oidc.user.OidcUser user)
    Picks the best display name the ID token offers.
    toResponse(org.springframework.security.oauth2.core.oidc.user.OidcUser user)
    Maps the signed-in user.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ROLES_CLAIM

      static final String ROLES_CLAIM
      ID token claim holding the roles of the user, as issued by the authorization server.
      See Also:
  • Constructor Details

    • SessionUserDtoMapper

      public SessionUserDtoMapper()
  • Method Details

    • toResponse

      public SessionUserResponse toResponse(org.springframework.security.oauth2.core.oidc.user.OidcUser user)
      Maps the signed-in user.
      Parameters:
      user - the authenticated OIDC user.
      Returns:
      its web representation: subject, display name, email and roles.
    • displayName

      private static String displayName(org.springframework.security.oauth2.core.oidc.user.OidcUser user)
      Picks the best display name the ID token offers.
      Parameters:
      user - the authenticated OIDC user.
      Returns:
      the full name, else the preferred username, else null.