Class SingleSignOnContext

java.lang.Object
com.vaadin.hilla.sso.starter.SingleSignOnContext

public class SingleSignOnContext extends Object
Contains utility methods and information related to single sign-on.
  • Constructor Details

    • SingleSignOnContext

      public SingleSignOnContext(org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository, SingleSignOnProperties properties, BackChannelLogoutSubscription backChannelLogoutSubscription)
  • Method Details

    • getOidcUser

      public static Optional<org.springframework.security.oauth2.core.oidc.user.OidcUser> getOidcUser()
      Conveniently get the current OIDC user from context.
      Returns:
      the OidcUser as an Optional, or null if the user is not authenticated or is not a OIDC user
    • getRegisteredProviders

      public @Nonnull List<@Nonnull String> getRegisteredProviders()
      Returns all the registered OAuth2 providers.
      Returns:
      a list of identifiers of the registered OAuth2 providers, as defined in the application properties.
    • getSingleSignOnData

      public SingleSignOnData getSingleSignOnData()
      Returns the data for the single sign-on, to be used to get everything with a single request.
      Returns:
      the data for the single sign-on.
    • userRoles

      public static List<String> userRoles(org.springframework.security.oauth2.core.oidc.user.OidcUser user)
      Returns the roles of the user, converted by removing the standard prefix.
      Parameters:
      user - the OIDC user.
      Returns:
      the roles of the user.
    • isBackChannelLogoutEnabled

      public boolean isBackChannelLogoutEnabled()
      Exposes the configuration property which determines whether the back-channel logout is enabled.
      Returns:
      true if the back-channel logout is enabled, false otherwise.
    • getBackChannelLogoutFlux

      public reactor.core.publisher.Flux<BackChannelLogoutSubscription.Message> getBackChannelLogoutFlux()
      Returns the Flux of back-channel logout messages for the current user.
      Returns:
      a flux which is a filter of the global flux.
    • getLogoutLink

      public Optional<String> getLogoutLink()
      Returns the URL of the back-channel logout endpoint. This must be called by the client to finalize the logout procedure.
      Returns:
      the URL of the back-channel logout endpoint as an Optional.