Class SynchronizingOidcUserMapper<T extends JmixOidcUser>

java.lang.Object
io.jmix.oidc.usermapper.BaseOidcUserMapper<T>
io.jmix.oidc.usermapper.SynchronizingOidcUserMapper<T>
Type Parameters:
T -
All Implemented Interfaces:
OidcUserMapper<T>

public abstract class SynchronizingOidcUserMapper<T extends JmixOidcUser> extends BaseOidcUserMapper<T>
Implementation of the OidcUserMapper that not only maps the external user object to the persistent user entity, but also stores the user and optionally their role assignment to the database.
  • Field Details

  • Constructor Details

  • Method Details

    • getApplicationUserClass

      protected abstract Class<T> getApplicationUserClass()
      Returns a class of the user used by the application. This user is set to the security context.
    • getOidcUserUsername

      protected String getOidcUserUsername(org.springframework.security.oauth2.core.oidc.user.OidcUser oidcUser)
      Extracts username from the oidcUser
    • initJmixUser

      protected T initJmixUser(org.springframework.security.oauth2.core.oidc.user.OidcUser oidcUser)
      Description copied from class: BaseOidcUserMapper
      Method returns an instance of Jmix user, which may be either a new instance or an instance loaded from the user repository. Attributes and authorities will lately be filled in other methods. The responsibility of the current method is just to create or load an existing instance.
      Specified by:
      initJmixUser in class BaseOidcUserMapper<T extends JmixOidcUser>
      Parameters:
      oidcUser - OpenID user
      Returns:
      new Jmix user instance or Jmix user loaded from user repository
    • populateUserAuthorities

      protected void populateUserAuthorities(org.springframework.security.oauth2.core.oidc.user.OidcUser oidcUser, T jmixUser)
      Description copied from class: BaseOidcUserMapper
      Fills authorities of jmixUser based on information from the oidcUser
      Specified by:
      populateUserAuthorities in class BaseOidcUserMapper<T extends JmixOidcUser>
    • performAdditionalModifications

      protected void performAdditionalModifications(org.springframework.security.oauth2.core.oidc.user.OidcUser oidcUser, T jmixUser)
      Description copied from class: BaseOidcUserMapper
      Performs additional modifications of Jmix user instance. Override this method in case you want to do some additional attribute values computations or if you want to do some operations with Jmix user instance, e.g. to store it in the database, like it is done in the SynchronizingOidcUserMapper
      Overrides:
      performAdditionalModifications in class BaseOidcUserMapper<T extends JmixOidcUser>
    • saveJmixUserAndRoleAssignments

      protected void saveJmixUserAndRoleAssignments(org.springframework.security.oauth2.core.oidc.user.OidcUser oidcUser, T jmixUser)
    • buildRoleAssignmentEntities

      protected Collection<RoleAssignmentEntity> buildRoleAssignmentEntities(String username, Collection<? extends org.springframework.security.core.GrantedAuthority> grantedAuthorities)
    • setSynchronizeRoleAssignments

      public void setSynchronizeRoleAssignments(boolean synchronizeRoleAssignments)
      Enables role assignment entities synchronization. If true then role assignment entities will be stored to the database.
    • isSynchronizeRoleAssignments

      public boolean isSynchronizeRoleAssignments()