Abstracted token credential allows retrieving a token from an external credential store.
To run this example, clone Jervis and execute ./gradlew console to bring up a Groovy Console with the classpath set up.
import net.gleske.jervis.remotes.interfaces.TokenCredential
class MyCredential implements TokenCredential {
String secret = 'super secret'
String getToken() {
this.secret
}
void setToken(String s) {
this.secret = s
}
}
def creds = new MyCredential()
println "TokenCredential instance? ${creds instanceof TokenCredential}"
println "Secret token: ${creds.token}"
creds.setToken('foo')
println creds.getToken()
Type Params | Return Type | Name and description |
---|---|---|
|
String |
getToken() When implemented, this method should return a String that is a token to be used in API service authentication in Jervis remotes. |
|
void |
setToken(String token) When implemented, this method should set the value of the token in a credential service. |
When implemented, this method should return a String that is a token to be used in API service authentication in Jervis remotes.
When implemented, this method should set the value of the token in a credential service. Note, this method can be implemented as a no-op.