Revert "[KS-OIDC] Remove special characters form sub OIDC standard claim (#5018)"

This reverts commit 45a062593f.
This commit is contained in:
Wenhao Zhou
2023-02-27 15:34:35 +08:00
committed by GitHub
parent a8ac54f489
commit 9dad732860
2 changed files with 2 additions and 3 deletions

View File

@@ -19,7 +19,6 @@ package oidc
import (
"context"
"crypto/tls"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
@@ -116,7 +115,7 @@ type oidcIdentity struct {
}
func (o oidcIdentity) GetUserID() string {
return base64.RawURLEncoding.EncodeToString([]byte(o.Sub))
return o.Sub
}
func (o oidcIdentity) GetUsername() string {

View File

@@ -198,7 +198,7 @@ var _ = Describe("OIDC", func() {
req := &http.Request{URL: url}
identity, err := provider.IdentityExchangeCallback(req)
Expect(err).Should(BeNil())
Expect(identity.GetUserID()).Should(Equal(base64.RawURLEncoding.EncodeToString([]byte("110169484474386276334"))))
Expect(identity.GetUserID()).Should(Equal("110169484474386276334"))
Expect(identity.GetUsername()).Should(Equal("test"))
Expect(identity.GetEmail()).Should(Equal("test@kubesphere.io"))
})