Class ApiKeyGuard.Builder
java.lang.Object
org.apache.juneau.rest.server.auth.ApiKeyGuard.Builder
- Enclosing class:
- ApiKeyGuard
Builder class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the guard.fromCookie(String value) Reads the key from the supplied cookie.fromHeader(String value) Reads the key from the supplied request header.Reads the key from the supplied query parameter.Sets theWWW-Authenticate: ApiKey realm="<value>"challenge realm.store(ApiKeyStore value) Sets the API-key store the guard delegates to.
-
Constructor Details
-
Builder
protected Builder()Constructor.
-
-
Method Details
-
store
Sets the API-key store the guard delegates to.- Parameters:
value- The store. Must not benull .- Returns:
- This object.
-
fromHeader
Reads the key from the supplied request header.Calls equivalent to
source(Source.HEADER)plusname(value). Defaults to"X-API-Key"when not set.- Parameters:
value- The header name. Must not benull or blank.- Returns:
- This object.
-
fromQuery
Reads the key from the supplied query parameter.- Parameters:
value- The query parameter name. Must not benull or blank.- Returns:
- This object.
-
fromCookie
Reads the key from the supplied cookie.- Parameters:
value- The cookie name. Must not benull or blank.- Returns:
- This object.
-
realm
Sets theWWW-Authenticate: ApiKey realm="<value>"challenge realm.- Parameters:
value- The realm. Must not benull or blank.- Returns:
- This object.
-
build
Builds the guard.- Returns:
- A new
ApiKeyGuard.
-