Merge pull request #15242 from kschu91/bugfix/15241

Fix refreshing oidc access token breaks users subiss in database
This commit is contained in:
Daniel Jiang 2021-07-16 10:58:31 +08:00 committed by GitHub
commit 3e983b1747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -55,7 +55,7 @@ func (md *metaDAO) DeleteByUserID(ctx context.Context, uid int) error {
}
func (md *metaDAO) GetByUsername(ctx context.Context, username string) (*models.OIDCUser, error) {
sql := `SELECT oidc_user.id, oidc_user.user_id, oidc_user.secret, oidc_user.token,
sql := `SELECT oidc_user.id, oidc_user.user_id, oidc_user.secret, oidc_user.subiss, oidc_user.token,
oidc_user.creation_time, oidc_user.update_time FROM oidc_user
JOIN harbor_user ON oidc_user.user_id = harbor_user.user_id
WHERE harbor_user.username = ?`

View File

@ -74,6 +74,7 @@ func (suite *MetaDaoTestSuite) TestGetByUsername() {
ou, err := suite.dao.GetByUsername(ctx, suite.username)
suite.Nil(err)
suite.Equal(suite.userID, ou.UserID)
suite.Equal("ca4bb144-4b5c-4d1b-9469-69cb3768af8fhttps://sso.andrea.muellerpublic.de/auth/realms/harbor", ou.SubIss)
suite.Equal("xxxx", ou.Token)
}