fix etcd pkce authcode json deserialization
Signed-off-by: Benjamin Ullian <bnu@tumblr.com>
This commit is contained in:
parent
a825a22f7a
commit
62abddca7d
@ -156,7 +156,11 @@ func (c *conn) CreateAuthCode(a storage.AuthCode) error {
|
|||||||
func (c *conn) GetAuthCode(id string) (a storage.AuthCode, err error) {
|
func (c *conn) GetAuthCode(id string) (a storage.AuthCode, err error) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), defaultStorageTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), defaultStorageTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
err = c.getKey(ctx, keyID(authCodePrefix, id), &a)
|
var ac AuthCode
|
||||||
|
err = c.getKey(ctx, keyID(authCodePrefix, id), &ac)
|
||||||
|
if err == nil {
|
||||||
|
a = toStorageAuthCode(ac)
|
||||||
|
}
|
||||||
return a, err
|
return a, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,24 @@ type AuthCode struct {
|
|||||||
CodeChallengeMethod string `json:"code_challenge_method,omitempty"`
|
CodeChallengeMethod string `json:"code_challenge_method,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func toStorageAuthCode(a AuthCode) storage.AuthCode {
|
||||||
|
return storage.AuthCode{
|
||||||
|
ID: a.ID,
|
||||||
|
ClientID: a.ClientID,
|
||||||
|
RedirectURI: a.RedirectURI,
|
||||||
|
ConnectorID: a.ConnectorID,
|
||||||
|
ConnectorData: a.ConnectorData,
|
||||||
|
Nonce: a.Nonce,
|
||||||
|
Scopes: a.Scopes,
|
||||||
|
Claims: toStorageClaims(a.Claims),
|
||||||
|
Expiry: a.Expiry,
|
||||||
|
PKCE: storage.PKCE{
|
||||||
|
CodeChallenge: a.CodeChallenge,
|
||||||
|
CodeChallengeMethod: a.CodeChallengeMethod,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func fromStorageAuthCode(a storage.AuthCode) AuthCode {
|
func fromStorageAuthCode(a storage.AuthCode) AuthCode {
|
||||||
return AuthCode{
|
return AuthCode{
|
||||||
ID: a.ID,
|
ID: a.ID,
|
||||||
|
Reference in New Issue
Block a user