Class ConsoleWrites
java.lang.Object
org.apache.juneau.petstore.console.ConsoleWrites
The console's write gate. Console writes are open by default; with
-Dpetstore.secure=true each one
needs the demo bearer token (StubBearerTokenValidator.DEFAULT_TOKENS). Also names the audit actor.
Example:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSetting (system property, environment, or any registered source) that turns on the console write gate. -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringactor(RestRequest req) Checks the write gate and returns the audit actor.static StringThe audit actor reduced to the staging author.roles(RestRequest req) The viewer's roles, for<@facts>and server-side omission of role-gated cards.
-
Field Details
-
SECURE_PROPERTY
Setting (system property, environment, or any registered source) that turns on the console write gate.- See Also:
-
-
Method Details
-
roles
The viewer's roles, for<@facts>and server-side omission of role-gated cards.Never an authorization check: writes still go through
actor(RestRequest). Independent ofpetstore.secure.- Parameters:
req- The request.- Returns:
["admin"]when the bearer token validates to theadminprincipal, else empty.
-
actor
Checks the write gate and returns the audit actor.- Parameters:
req- The request.- Returns:
"console:<user>"when a valid bearer token is present, else"console".- Throws:
Unauthorized- If the gate is on and the token is missing or unknown.
-
author
The audit actor reduced to the staging author.- Parameters:
actor- Aactor(RestRequest)value.- Returns:
- The bare user (
"admin"), or"anonymous"when writes are unsecured.
-