Class StandaloneLoginFlow<T,U>
java.lang.Object
com.svenruppert.jsentinel.standalone.StandaloneLoginFlow<T,U>
- Type Parameters:
T- the credentials typeU- the subject type
Drives the login lifecycle for standalone applications without any
UI-toolkit assumption. A typical CLI / desktop main loop calls
login(Object, String) once with the user-entered credentials
and the displayed username (used for brute-force tracking + audit),
then carries on with the request-handling loop.
Behaviour mirrors the Vaadin / REST flow:
- Ask
LoginAttemptPolicywhether the username is currently throttled — returnStandaloneLoginFlow.LoginResult.lockedOut(LoginAttemptDecision.LockedOut)on a hit so the caller can render a wait time. - Delegate to the registered
AuthenticationService. - On success — load the subject, bind it into the active
SubjectStore, record the success on the policy and emit aLoginSucceededaudit event. - On failure — record the failure on the policy and emit a
LoginFailedaudit event.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionUses the SPI-resolvedAuthenticationServiceand the system UTC clock.StandaloneLoginFlow(com.svenruppert.jsentinel.authentication.AuthenticationService<T, U> authenticationService, Clock clock) Test seam. -
Method Summary
Modifier and TypeMethodDescriptionvoidbindToken(com.svenruppert.jsentinel.credential.propagation.TokenCredential credential) V00.74 — bind aTokenCredentialfor the current thread so@PropagateToken-annotated wrappers can forward it to downstream HTTP calls.Runs one login attempt.voidlogout()Removes the current subject from theSubjectStore.
-
Constructor Details
-
StandaloneLoginFlow
public StandaloneLoginFlow()Uses the SPI-resolvedAuthenticationServiceand the system UTC clock. The most common entry point. -
StandaloneLoginFlow
-
-
Method Details
-
login
Runs one login attempt.- Parameters:
credentials- credentials accepted by the configuredAuthenticationServiceusername- displayed username, used for brute-force tracking and audit; may benullor empty for anonymous flows (no throttling applies)- Returns:
- the outcome
-
logout
public void logout()Removes the current subject from theSubjectStore. Does not emit an audit event — that is theLogoutService's responsibility, which standalone applications wire up explicitly when they need it. -
bindToken
public void bindToken(com.svenruppert.jsentinel.credential.propagation.TokenCredential credential) V00.74 — bind aTokenCredentialfor the current thread so@PropagateToken-annotated wrappers can forward it to downstream HTTP calls. Convenience for the standalone / CLI demo pattern (after a successful login, the caller has the token at hand and binds it here).Looks up the SPI-resolved
TokenCredentialStore(see Konzept §6.3).- Parameters:
credential- the credential to bind; non-null
-