summaryrefslogtreecommitdiff
path: root/internal/storage/sql_provider.go
diff options
context:
space:
mode:
authorJames Elliott <james-d-elliott@users.noreply.github.com>2023-08-17 22:07:10 +1000
committerGitHub <noreply@github.com>2023-08-17 22:07:10 +1000
commit895cdc28a05f61ab7efc763c9c48a4d72ee7def5 (patch)
treec75cc0ff52c02b1cd24c9d63ce9070ed3b9f49f5 /internal/storage/sql_provider.go
parent1d72ad5dcefd347b272e1614d2f09c1639645dee (diff)
fix(oidc): failure to insert with client credentials grant (#5809)
This fixes an issue where the client credentials grant fails on insert as the challenge_id foreign key constraint can't be null. This resolves this issue allowing the access token associated (as this is the only token that can be generated), to be null. Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
Diffstat (limited to 'internal/storage/sql_provider.go')
-rw-r--r--internal/storage/sql_provider.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/storage/sql_provider.go b/internal/storage/sql_provider.go
index 0c4d6376e..98964ae4f 100644
--- a/internal/storage/sql_provider.go
+++ b/internal/storage/sql_provider.go
@@ -516,11 +516,11 @@ func (p *SQLProvider) SaveOAuth2Session(ctx context.Context, sessionType OAuth2S
case OAuth2SessionTypeRefreshToken:
query = p.sqlInsertOAuth2RefreshTokenSession
default:
- return fmt.Errorf("error inserting oauth2 session for subject '%s' and request id '%s': unknown oauth2 session type '%s'", session.Subject, session.RequestID, sessionType)
+ return fmt.Errorf("error inserting oauth2 session for subject '%s' and request id '%s': unknown oauth2 session type '%s'", session.Subject.String, session.RequestID, sessionType)
}
if session.Session, err = p.encrypt(session.Session); err != nil {
- return fmt.Errorf("error encrypting oauth2 %s session data for subject '%s' and request id '%s' and challenge id '%s': %w", sessionType, session.Subject, session.RequestID, session.ChallengeID.String(), err)
+ return fmt.Errorf("error encrypting oauth2 %s session data for subject '%s' and request id '%s' and challenge id '%s': %w", sessionType, session.Subject.String, session.RequestID, session.ChallengeID.UUID, err)
}
_, err = p.db.ExecContext(ctx, query,
@@ -530,7 +530,7 @@ func (p *SQLProvider) SaveOAuth2Session(ctx context.Context, sessionType OAuth2S
session.Active, session.Revoked, session.Form, session.Session)
if err != nil {
- return fmt.Errorf("error inserting oauth2 %s session data for subject '%s' and request id '%s' and challenge id '%s': %w", sessionType, session.Subject, session.RequestID, session.ChallengeID.String(), err)
+ return fmt.Errorf("error inserting oauth2 %s session data for subject '%s' and request id '%s' and challenge id '%s': %w", sessionType, session.Subject.String, session.RequestID, session.ChallengeID.UUID, err)
}
return nil
@@ -666,7 +666,7 @@ func (p *SQLProvider) LoadOAuth2Session(ctx context.Context, sessionType OAuth2S
}
if session.Session, err = p.decrypt(session.Session); err != nil {
- return nil, fmt.Errorf("error decrypting the oauth2 %s session data with signature '%s' for subject '%s' and request id '%s': %w", sessionType.String(), signature, session.Subject, session.RequestID, err)
+ return nil, fmt.Errorf("error decrypting the oauth2 %s session data with signature '%s' for subject '%s' and request id '%s': %w", sessionType.String(), signature, session.Subject.String, session.RequestID, err)
}
return session, nil