Class AuthDataInitializer

java.lang.Object
hu.rts.mike.example.dev.crm.security.AuthDataInitializer
All Implemented Interfaces:
EventListener, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>

@Component public class AuthDataInitializer extends Object implements org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
  • Field Details

    • alreadyInitialized

      protected boolean alreadyInitialized
    • authInfoRepository

      protected final AuthInfoRepository authInfoRepository
    • userInfoRepository

      protected final UserInfoRepository userInfoRepository
    • roleRepository

      protected final RoleRepository roleRepository
    • passwordEncoder

      private final org.springframework.security.crypto.password.PasswordEncoder passwordEncoder
  • Constructor Details

  • Method Details

    • createRoleIfNotFound

      public Role createRoleIfNotFound(String name, Set<Privilege> privileges)
    • createAuthAndUserInfoIfNotFound

      public AuthInfo createAuthAndUserInfoIfNotFound(String name, String displayName, Set<Role> roles)
    • onApplicationEvent

      public void onApplicationEvent(@NonNull org.springframework.context.event.ContextRefreshedEvent event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>