validateLoginRequest validates that the login request has either the refresh token or the pair
(request *api.LoginRequest)
| 220 | // validateLoginRequest validates that the login request has either the refresh token or the |
| 221 | // <user id, password> pair |
| 222 | func validateLoginRequest(request *api.LoginRequest) error { |
| 223 | if request == nil { |
| 224 | return errors.Errorf("the request should not be nil") |
| 225 | } |
| 226 | // we will use the refresh token for authentication if it's set |
| 227 | if len(request.RefreshToken) > 0 { |
| 228 | return nil |
| 229 | } |
| 230 | |
| 231 | // otherwise make sure both userid and password are set |
| 232 | if len(request.Userid) == 0 { |
| 233 | return errors.Errorf("the userid should not be empty") |
| 234 | } |
| 235 | if len(request.Password) == 0 { |
| 236 | return errors.Errorf("the password should not be empty") |
| 237 | } |
| 238 | return nil |
| 239 | } |
| 240 | |
| 241 | // getAccessJwt constructs an access jwt with the given user id, groupIds, namespace |
| 242 | // and expiration TTL specified by worker.Config.AccessJwtTtl |
no test coverage detected