Class SimpleAuthenticationConfig

    • Constructor Detail

      • SimpleAuthenticationConfig

        public SimpleAuthenticationConfig()
    • Method Detail

      • addUser

        public SimpleAuthenticationConfig addUser​(@Nonnull
                                                  java.lang.String username,
                                                  @Nonnull
                                                  java.lang.String password,
                                                  java.lang.String... roles)
        Adds one user to the configuration.
        Parameters:
        username - username
        password - user's password
        roles - roles assigned to the user
        Returns:
        this object
      • setRoleSeparator

        public SimpleAuthenticationConfig setRoleSeparator​(@Nullable
                                                           java.lang.String roleSeparator)
        Allows to use a custom role separator in the configuration. It's important in case when a role name contains the default separator "," (comma).
        Parameters:
        roleSeparator - new separator
        Returns:
        this object
      • getRoleSeparator

        @Nullable
        public java.lang.String getRoleSeparator()
        Returns the custom role separator (when set). If no custom one is used, null is returned and default separator is used ("," - comma).
        Returns:
        the separator
      • getUsernames

        @Nonnull
        public java.util.Set<java.lang.String> getUsernames()
        Returns names of users registered in the configuration.
        Returns:
        set of usernames
      • getPassword

        public java.lang.String getPassword​(@Nonnull
                                            java.lang.String username)
        Return the configured password for given username.
        Parameters:
        username - username
        Returns:
        user's password or null if such user doesn't exist
      • getRoles

        public java.util.Set<java.lang.String> getRoles​(@Nonnull
                                                        java.lang.String username)
        Returns role names assigned to the given user.
        Parameters:
        username - username
        Returns:
        configured roles or null if the user doesn't exist
      • asLoginModuleConfigs

        public LoginModuleConfig[] asLoginModuleConfigs()
        Description copied from interface: AuthenticationConfig
        Converts current configuration to stack of login modules.
        Returns:
        login modules stack
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • requireNonEmpty

        protected static java.lang.String requireNonEmpty​(java.lang.String str,
                                                          java.lang.String message)