Package services.gui

Class ApiTokenService


  • @Singleton
    public class ApiTokenService
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.commons.lang3.tuple.Pair<ApiToken,​java.lang.String> create​(User user, java.lang.String name, java.lang.Integer expires)
      Generates a new api token and persists its hash in the database.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • create

        public org.apache.commons.lang3.tuple.Pair<ApiToken,​java.lang.String> create​(User user,
                                                                                           java.lang.String name,
                                                                                           java.lang.Integer expires)
        Generates a new api token and persists its hash in the database. Returns the token and the token string. A token consists of the prefix "jap_" + a random string of 31 characters and a checksum of 6 characters.