refact(authmethods): Add top level token type to Authenticate (#2010)
Other parts of the system make use of a "type" field, while the AuthenticateResponse sets a "token_type" on the response attributes directly. Rename this field to "type", and move it up to the response level, to be more consistent with other RPCs. Also adds a new field to the AuthenticateRequest, "type" which will replace the "token_type" field over time.
This commit is contained in:
1 parent
bf9e7874b1
commit
80b2c9230f
15 files changed
+246
-171
No files matched your search
@@ -32,7 +32,7 @@ func TestAuthenticationHandler(t *testing.T) {
|
||||
"password": "password123",
|
||||
},
|
||||
}
|
||||
// No token_type defined means "token" type
|
||||
// No "type" defined means "token" type
|
||||
b, err := json.Marshal(request)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -54,7 +54,7 @@ func TestAuthenticationHandler(t *testing.T) {
|
||||
assert.Truef(t, strings.HasPrefix(tok, pubId), "Token: %q, Id: %q", tok, pubId)
|
||||
|
||||
// Set the token type to cookie and make sure the body does not contain the token anymore.
|
||||
request["token_type"] = "cookie"
|
||||
request["type"] = "cookie"
|
||||
b, err = json.Marshal(request)
|
||||
require.NoError(t, err)
|
||||
resp, err = http.Post(fmt.Sprintf("%s/v1/auth-methods/ampw_1234567890:authenticate", c.ApiAddrs()[0]), "application/json", bytes.NewReader(b))
|
||||
|
||||
Reference in new issue
Block a user