Package jmri.server.json
Class JsonDeleteTokenManager
- java.lang.Object
-
- jmri.server.json.JsonDeleteTokenManager
-
class JsonDeleteTokenManager extends java.lang.Object
Manager for deletion tokens in the JSON protocols. This is a separate manager to be able to support the RESTful API where the connection where a token is generated may be broken before the client's deletion request containing the token is sent.Note this is package private and is not part of a committed to API.
- Since:
- 4.15.6
-
-
Constructor Summary
Constructors Constructor Description JsonDeleteTokenManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) boolean
acceptToken(java.lang.String type, java.lang.String name, java.lang.String token)
Accept a token.(package private) static JsonDeleteTokenManager
getDefault()
Use this method to access the default instance.(package private) java.lang.String
getToken(java.lang.String type, java.lang.String name)
Generate a token to allow deletion following the rejection of a deletion request.
-
-
-
Constructor Detail
-
JsonDeleteTokenManager
JsonDeleteTokenManager()
-
-
Method Detail
-
getDefault
static JsonDeleteTokenManager getDefault()
Use this method to access the default instance. This ensures that public API does not need to be exposed forInstanceManagerAutoDefault
to function.- Returns:
- the default instance
-
acceptToken
boolean acceptToken(@Nonnull java.lang.String type, @Nonnull java.lang.String name, @CheckForNull java.lang.String token)
Accept a token. If the token is not valid, any valid token is also invalidated.- Parameters:
type
- the type of the object to deletename
- the name of the object to deletetoken
- the token to test- Returns:
- true if the token was accepted; false otherwise
-
getToken
java.lang.String getToken(@Nonnull java.lang.String type, @Nonnull java.lang.String name)
Generate a token to allow deletion following the rejection of a deletion request.- Parameters:
type
- the type of the object to deletename
- the name of the object to delete- Returns:
- the token to use to confirm a deletion should be accepted
-
-