trait ReadonlyTokenCredential
A read only credential interface which partially implements TokenCredential.
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.creds.ReadonlyTokenCredential import net.gleske.jervis.remotes.interfaces.TokenCredential class MyCredential implements ReadonlyTokenCredential { String secret = 'super secret' String getToken() { this.secret } } // in this example creds.setToken('') is a no-op def creds = new MyCredential() println "TokenCredential instance? ${creds instanceof TokenCredential}" println "Secret token: ${creds.token}" creds.setToken( 'foo') println creds.getToken()
When implemented, this method should return a String that is a token to be used in API service authentication in Jervis remotes.
Implemented to do nothing. If a setToken is called then it will be discarded.
token
- Does not matter because it will be discarded.