public class AuthenticationService extends CharmService
| Type | Property and Description |
|---|---|
javafx.beans.property.ReadOnlyObjectProperty<User> |
authenticatedUser
The user that is currently authenticated, which can be
null
if no user is authenticated. |
gluonClient| Constructor and Description |
|---|
AuthenticationService(GluonClient gluonClient)
The AuthenticationService allows the application to authenticate users
and keep track of which user is currently logged in.
|
| Modifier and Type | Method and Description |
|---|---|
<O> void |
authenticate(java.util.function.Consumer<O> consumer,
O acceptable)
Start the authentication flow.
|
javafx.beans.property.ReadOnlyObjectProperty<User> |
authenticatedUserProperty()
The user that is currently authenticated, which can be
null
if no user is authenticated. |
User |
getAuthenticatedUser()
Gets the value of the property authenticatedUser.
|
boolean |
isAuthenticated()
Check whether the application is successfully authenticated with a user.
|
getGluonClientpublic javafx.beans.property.ReadOnlyObjectProperty<User> authenticatedUserProperty
null
if no user is authenticated.getAuthenticatedUser()public AuthenticationService(GluonClient gluonClient)
The service will use the
AuthenticationViewFactory to try and load an
implementation of the AuthenticationView.
Authentication will only be possible when an implementation could be
found.
Whenever a user gets authenticated successfully, the information will be stored in the private storage of the device where the application is run. The next time the AuthenticationService is created, it will check if such information is available and automatically authenticate the user with the information that was stored.
gluonClient - The GluonClient instance used to connect with Gluon
Cloud.public boolean isAuthenticated()
true when an authenticated user is available,
false otherwise.public User getAuthenticatedUser()
null if no user is
authenticated.public javafx.beans.property.ReadOnlyObjectProperty<User> authenticatedUserProperty()
null
if no user is authenticated.getAuthenticatedUser()public <O> void authenticate(java.util.function.Consumer<O> consumer,
O acceptable)
acceptable object.O - The type of the acceptable object that will be accepted by the
consumer.consumer - a consumer that will be called when authentication is
completedacceptable - the object to pass to the consumer's accept method