java.lang.Object
org.bzdev.ejws.EjwsAuthenticator.UserInfo
- Enclosing class:
- EjwsAuthenticator
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 Summary
ConstructorsModifierConstructorDescriptionprotectedUserInfo(EmbeddedWebServer ews, EjwsAuthenticator auth, String user, String password, String publicKeyPEM) Constructor given a public key and password.protectedUserInfo(EmbeddedWebServer ews, EjwsAuthenticator auth, String key, String title, String gpghome, String[] recipients) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected EjwsAuthenticator.UserInfoaddUser()Add the user to the authenticator without creating an SBL file.addUser(boolean gzip) Finish creating an SBL file and add the user to the authenticator.getBase()Get the user's base URI.getMode()Get a user's authentication mode.Get the user's password.Get the public key.getRoles()Get a user's roles.byte[]getSBL()Get the SBL file.Get a user's user namebooleanisActive()Determine whether or not this entry is active.booleanDetermine if SBL data is compressed.setActive(boolean active) Set whether or not this entry is active.setAllowLoopback(boolean value) Set whether or not a user allows the use of the loopback interface in a certificate.protected EjwsAuthenticator.UserInfoSet a user's URI base.setDescription(String description) Set a user's description field.setSelfSigned(boolean value) Set whether or not a user accepts self-signed certificates.setTruststore(String trustStore) Set a user's trust storesetTruststorePW(char[] pw) Set a user's password for a trust store.Set a user's starting URI.Set a user's user name.uri()Get a user's URI.
-
Constructor Details
-
UserInfo
protected UserInfo(EmbeddedWebServer ews, EjwsAuthenticator auth, String key, String title, String gpghome, String[] recipients) throws IllegalStateException Constructor. The key is an identifier acceptable for use as a Java variable name.- Parameters:
ews- the web serverauth- theEjwsAuthenticatorfor thisEjwsAuthenticator.UserInfokey- the user's keytitle- a title for the SBL filegpghome- the GPG home directory; null for the defaultrecipients- the recipients' names, key IDs or other strings acceptable for the gpg -r option- Throws:
IllegalStateException- if the recipient does not have a known GPG public key or if there was a certificate error
-
UserInfo
protected UserInfo(EmbeddedWebServer ews, EjwsAuthenticator auth, String user, String password, String publicKeyPEM) Constructor given a public key and password. The key is an identifier acceptable for use as a Java variable name.- Parameters:
ews- the web serverauth- theEjwsAuthenticatorfor thisEjwsAuthenticator.UserInfouser- the user namepassword- a basic-authentication password; null for a defaultpublicKeyPEM- a PEM encoded elliptic-curve public key
-
-
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
Get a user's roles.- Returns:
- a set of roles
-
getPublicKey
Get the public key.- Returns:
- the public key
-
getUserName
Get a user's user name- Returns:
- the user's user name.
-
getPassword
Get the user's password.- Returns:
- the user's password
-
getBase
Get the user's base URI. This is the common portion of a URI to which an authenticator applies.- Returns:
- the URI
-
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
Get a user's authentication mode.- Returns:
- the mode
-
setActive
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
-
setTruststore
Set a user's trust store- Parameters:
trustStore- the file name of the user's trust store- Returns:
- this object
- Throws:
IllegalStateException
-
setTruststorePW
Set a user's password for a trust store.- Parameters:
pw- the password- Returns:
- this object
- Throws:
IllegalStateException
-
setSelfSigned
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
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
Set a user's description field.- Parameters:
description- a description for the entries under the current key- Returns:
- this object
- Throws:
IllegalStateException
-
setUser
Set a user's user name.- Parameters:
username- a user name- Returns:
- this object
- Throws:
IllegalStateException
-
setBase
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
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
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
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
-