1   package com.atlassian.seraph.spi.rememberme;
2   
3   import com.atlassian.seraph.service.rememberme.RememberMeToken;
4   
5   /**
6    * Each Seraph ready application needs to provide a spi Dao to hold and return remember me cookie information against a
7    * user.
8    */
9   public interface RememberMeTokenDao
10  {
11      /**
12       * When this call is made, the app is expected to do some validation on the state of the token.
13       * <p/>
14       * If the token is found but it has expired then the application is expected to clean up the token data then and
15       * there and return null.  It MUST NEVER return an expired token
16       *
17       * @param tokenId the id of the token
18       *
19       * @return a valid and filled out RememberMeToken or null if one cant be found or its expired.
20       */
21      RememberMeToken findById(Long tokenId);
22  
23      /**
24       * This will be called to save the presented token to the database against the specified user.  The id field will
25       * need to be filled out during this process, as well the expiry and created fields.
26       *
27       * @param token the token in play
28       *
29       * @return a persisted token that has the correct database id filled out
30       */
31      RememberMeToken save(RememberMeToken token);
32  }