public static final String produceToken ( String principal , Set < String > roles , int expiresInMillis ) { AuthToken authToken = createAuthToken ( principal , roles , expiresInMillis ) ; String json = toJSON ( authToken ) ; return StringUtils . newStringUtf8 ( Base64 . encodeBase64 ( StringUtils . getBytesUtf8 ( json ) ) ) ; }
Produce a token suitable for transmission . This will generate the auth token then serialize it to a JSON string then Base64 encode the JSON .