2013-08-22 57 views

回答

0

你可以嘗試驗證自己的東西,在延長UserServicePlugin,例如,在斯卡拉和Java自定義類可here

class MyUserService(application: Application) extends UserServicePlugin(application) { 
    /** 
    * Finds a user that maches the specified id 
    * 
    * @param id the user id 
    * @return an optional user 
    */ 
    def find(id: UserId):Option[Identity] = { 
    // implement me 
    } 

    /** 
    * Finds a user by email and provider id. 
    * 
    * Note: If you do not plan to use the UsernamePassword provider just provide en empty 
    * implementation. 
    * 
    * @param email - the user email 
    * @param providerId - the provider id 
    * @return 
    */ 
    def findByEmailAndProvider(email: String, providerId: String):Option[Identity] = 
    { 
    // implement me 
    } 

    /** 
    * Saves the user. This method gets called when a user logs in. 
    * This is your chance to save the user information in your backing store. 
    * @param user 
    */ 
    def save(user: Identity) { 
    // implement me 
    } 

    /** 
    * Saves a token. This is needed for users that 
    * are creating an account in the system instead of using one in a 3rd party system. 
    * 
    * Note: If you do not plan to use the UsernamePassword provider just provide en empty 
    * implementation 
    * 
    * @param token The token to save 
    * @return A string with a uuid that will be embedded in the welcome email. 
    */ 
    def save(token: Token) = { 
    // implement me 
    } 


    /** 
    * Finds a token 
    * 
    * Note: If you do not plan to use the UsernamePassword provider just provide en empty 
    * implementation 
    * 
    * @param token the token id 
    * @return 
    */ 
    def findToken(token: String): Option[Token] = { 
    // implement me 
    } 

    /** 
    * Deletes a token 
    * 
    * Note: If you do not plan to use the UsernamePassword provider just provide en empty 
    * implementation 
    * 
    * @param uuid the token id 
    */ 
    def deleteToken(uuid: String) { 
    // implement me 
    } 

    /** 
    * Deletes all expired tokens 
    * 
    * Note: If you do not plan to use the UsernamePassword provider just provide en empty 
    * implementation 
    * 
    */ 
    def deleteExpiredTokens() { 
    // implement me 
    } 
} 

這些方法是使用securesocial在您的播放應用的整個登錄過程生命週期期間調用插入。