Class Authentication


  • public class Authentication
    extends Object
    Definition of authentication given to username after verification of credentials by authentication provider. Each authentication must at least point to some identity (username), roles, and may also be valid for a specific scope only.
    Author:
    Ɓukasz Dywicki - Initial contribution, Kai Kreuzer - Added JavaDoc and switched from array to Set, Yannick Schaus - Add scope
    • Constructor Detail

      • Authentication

        protected Authentication()
        no-args constructor required by gson
      • Authentication

        public Authentication​(String username,
                              String... roles)
        Creates a new instance
        Parameters:
        username - name of the user associated to this authentication instance
        roles - a variable list of roles that the user possesses.
      • Authentication

        public Authentication​(String username,
                              String[] roles,
                              String scope)
        Creates a new instance with a specific scope
        Parameters:
        username - name of the user associated to this authentication instance
        roles - a variable list of roles that the user possesses.
        scope - a scope this authentication is valid for
    • Method Detail

      • getUsername

        public String getUsername()
        Retrieves the name of the authenticated user
        Returns:
        user name
      • getRoles

        public Set<String> getRoles()
        Retrieves the roles of the authenticated user
        Returns:
        a set of roles
      • getScope

        public String getScope()
        Retrieves the scope this authentication is valid for
        Returns:
        a scope