func (s *UserConversion) ConvertToAuthorizeToken(user interface{}, token *oapi.OAuthAuthorizeToken) error { info, ok := user.(kuser.Info) if !ok { return errors.New("did not receive user.Info") } token.UserName = info.GetName() if token.UserName == "" { return errors.New("user name is empty") } token.UserUID = info.GetUID() return nil }
func (u *testUser) ConvertToAuthorizeToken(_ interface{}, token *api.OAuthAuthorizeToken) error { token.UserName = u.UserName token.UserUID = u.UserUID return u.Err }