Modifier and Type | Field and Description |
---|---|
static AuthDesc |
theOpenAuth
Singleton open authorization descriptor.
|
Constructor and Description |
---|
AuthDesc(String mode,
OptString code,
OptString id)
JSON-driven constructor.
|
AuthDesc(String mode,
String code,
String id)
Direct constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
code()
Get the authorization code.
|
JSONLiteral |
encode(EncodeControl control)
Encode this object for transmission or persistence.
|
static AuthDesc |
fromProperties(BootProperties props,
String propRoot,
Trace appTrace)
Produce an AuthDesc object from information contained in the server
configuration properties.
|
String |
id()
Get the authorization ID.
|
String |
mode()
Get the authorization mode.
|
boolean |
verify(AuthDesc auth)
Check an authorization.
|
public static final AuthDesc theOpenAuth
public AuthDesc(String mode, String code, String id)
mode
- Authorization mode.code
- Authorization code, or null if not relevant.id
- Authorization ID, or null if not relevant.@JSONMethod(value={"mode","code","id"}) public AuthDesc(String mode, OptString code, OptString id)
mode
- Authorization mode.code
- Optional authorization code.id
- Optional authorization ID.public String code()
public static AuthDesc fromProperties(BootProperties props, String propRoot, Trace appTrace)
The authorization mode is extracted from propRoot+".auth.mode". Currently, there are three possible authorization mode values that are recognized: "open", "password", and "reservation".
Open mode is unrestricted access. No additional descriptive information is required for open mode.
Password mode requires a secret code string for access. This code string is extracted from propRoot+".auth.code". Additionally, an identifier may also be required, which will be extracted from propRoot+".auth.id" if that property is present.
Reservation mode requires a reservation string for access. The reservation string is communicated via a separate pathway, but it optionally may be associated with an identifier extracted from propRoot+".auth.id".
props
- The properties themselves.propRoot
- Prefix string for all the properties describing the
authorization information of interest.appTrace
- Trace object for error logging.public String id()
public String mode()
public boolean verify(AuthDesc auth)
auth
- Authorization credentials being presented.public JSONLiteral encode(EncodeControl control)
Copyright © 2017. All rights reserved.