Class EjwsAuthenticator.UserInfo

java.lang.Object
org.bzdev.ejws.EjwsAuthenticator.UserInfo
Enclosing class:
EjwsAuthenticator

public static class EjwsAuthenticator.UserInfo extends Object
Class to generate user info. Normally instances of this class are created by calling EjwsAuthenticator.createUser(String,String,String[],Set), which will configure an authenticator to call setBase(String) when the argument to setBase (equal to a prefix) is available. Example:

 EjwsSecureBasicAuth auth = new
       EjwsSecureBasicAuth("test-realm",
                           SecureBasicUtilities.Mode
                           .SIGNATURE_WITH_CERT);
 String recipients[] = {
   "user@example.com"
 };
 var user = new EjwsSecureBasicAuth
            .UserInfo(auth, "usrkey", "SBL Example",
                      null, recipients)
            .setDescription("Example using localhost")
            .setUser("user@example.com")
            .setBase("https://example.com/")
            .setURI("https://example.com/login.html")
            .addUser(true);
 
  • Constructor Details

  • Method Details

    • isActive

      public boolean isActive()
      Determine whether or not this entry is active. Authentication should fail if an entry is not active.
      Returns:
      true if the entry is active; false otherwise
    • getRoles

      public Set<String> getRoles()
      Get a user's roles.
      Returns:
      a set of roles
    • getPublicKey

      public String getPublicKey()
      Get the public key.
      Returns:
      the public key
    • getUserName

      public String getUserName()
      Get a user's user name
      Returns:
      the user's user name.
    • getPassword

      public String getPassword()
      Get the user's password.
      Returns:
      the user's password
    • getBase

      public String getBase()
      Get the user's base URI. This is the common portion of a URI to which an authenticator applies.
      Returns:
      the URI
    • uri

      public String uri()
      Get a user's URI. This is the URI a user is expected to use initially.
      Returns:
      the URI
    • getSBL

      public byte[] getSBL()
      Get the SBL file.
      Returns:
      the SBL file as a byte array
    • isSBLCompressed

      public boolean isSBLCompressed()
      Determine if SBL data is compressed.
      Returns:
      true if {#getSBL()} returns GZIP-compressed data; false otherwise
    • getMode

      public SecureBasicUtilities.Mode getMode()
      Get a user's authentication mode.
      Returns:
      the mode
    • setActive

      public EjwsAuthenticator.UserInfo setActive(boolean active)
      Set whether or not this entry is active. Authentication should fail if an entry is not active. If this method was not called or overridden, isActive() will return true.
      Parameters:
      active - true if the entry is active; false otherwise
    • setRoles

      public EjwsAuthenticator.UserInfo setRoles(Set<String> roles)
    • setTruststore

      public EjwsAuthenticator.UserInfo setTruststore(String trustStore) throws IllegalStateException
      Set a user's trust store
      Parameters:
      trustStore - the file name of the user's trust store
      Returns:
      this object
      Throws:
      IllegalStateException
    • setTruststorePW

      public EjwsAuthenticator.UserInfo setTruststorePW(char[] pw) throws IllegalStateException
      Set a user's password for a trust store.
      Parameters:
      pw - the password
      Returns:
      this object
      Throws:
      IllegalStateException
    • setSelfSigned

      public EjwsAuthenticator.UserInfo setSelfSigned(boolean value) throws IllegalStateException
      Set whether or not a user accepts self-signed certificates.
      Parameters:
      value - true to accept self-signed certificates; false otherwise
      Returns:
      this object
      Throws:
      IllegalStateException
    • setAllowLoopback

      public EjwsAuthenticator.UserInfo setAllowLoopback(boolean value) throws IllegalStateException
      Set whether or not a user allows the use of the loopback interface in a certificate.
      Parameters:
      value - true if the loopback interface is allowed for SSL connections; false otherwise
      Returns:
      this object
      Throws:
      IllegalStateException
    • setDescription

      public EjwsAuthenticator.UserInfo setDescription(String description) throws IllegalStateException
      Set a user's description field.
      Parameters:
      description - a description for the entries under the current key
      Returns:
      this object
      Throws:
      IllegalStateException
    • setUser

      public EjwsAuthenticator.UserInfo setUser(String username) throws IllegalStateException
      Set a user's user name.
      Parameters:
      username - a user name
      Returns:
      this object
      Throws:
      IllegalStateException
    • setBase

      protected EjwsAuthenticator.UserInfo setBase(String base) throws IllegalStateException
      Set a user's URI base. If the path is relative, the string "/" will be automatically prepended.
      Parameters:
      base - an absolute path
      Returns:
      this object
      Throws:
      IllegalStateException
    • setURI

      public EjwsAuthenticator.UserInfo setURI(String path)
      Set a user's starting URI.
      Parameters:
      path - a relative path and query that will be appended to the base path.
      Returns:
      this object
    • addUser

      public EjwsAuthenticator.UserInfo addUser(boolean gzip)
      Finish creating an SBL file and add the user to the authenticator.
      Parameters:
      gzip - true if GZIP compression should be used; false otherwise
      Returns:
      this object
      Throws:
      IllegalStateException - if the constructor did not provide an SBL file or the user was already added
    • addUser

      protected EjwsAuthenticator.UserInfo addUser()
      Add the user to the authenticator without creating an SBL file.
      Returns:
      this object
      Throws:
      IllegalStateException - if the constructor provided an SBL file or the user was already added