Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
3611c5c4
Unverified
Commit
3611c5c4
authored
Sep 26, 2018
by
k8s-ci-robot
Committed by
GitHub
Sep 26, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #68850 from mikedanese/oidc
oidc: respect the legacy goog issuer
parents
b1133090
1873ad48
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
oidc.go
....io/apiserver/plugin/pkg/authenticator/token/oidc/oidc.go
+6
-0
oidc_test.go
...piserver/plugin/pkg/authenticator/token/oidc/oidc_test.go
+22
-0
No files found.
staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/oidc/oidc.go
View file @
3611c5c4
...
...
@@ -342,6 +342,12 @@ func untrustedIssuer(token string) (string, error) {
if
err
:=
json
.
Unmarshal
(
payload
,
&
claims
);
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"while unmarshaling token: %v"
,
err
)
}
// Coalesce the legacy GoogleIss with the new one.
//
// http://openid.net/specs/openid-connect-core-1_0.html#GoogleIss
if
claims
.
Issuer
==
"accounts.google.com"
{
return
"https://accounts.google.com"
,
nil
}
return
claims
.
Issuer
,
nil
}
...
...
staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/oidc/oidc_test.go
View file @
3611c5c4
...
...
@@ -1365,6 +1365,28 @@ func TestToken(t *testing.T) {
},
wantInitErr
:
true
,
},
{
name
:
"accounts.google.com issuer"
,
options
:
Options
{
IssuerURL
:
"https://accounts.google.com"
,
ClientID
:
"my-client"
,
UsernameClaim
:
"email"
,
now
:
func
()
time
.
Time
{
return
now
},
},
claims
:
fmt
.
Sprintf
(
`{
"iss": "accounts.google.com",
"email": "thomas.jefferson@gmail.com",
"aud": "my-client",
"exp": %d
}`
,
valid
.
Unix
()),
signingKey
:
loadRSAPrivKey
(
t
,
"testdata/rsa_1.pem"
,
jose
.
RS256
),
pubKeys
:
[]
*
jose
.
JSONWebKey
{
loadRSAKey
(
t
,
"testdata/rsa_1.pem"
,
jose
.
RS256
),
},
want
:
&
user
.
DefaultInfo
{
Name
:
"thomas.jefferson@gmail.com"
,
},
},
}
for
_
,
test
:=
range
tests
{
t
.
Run
(
test
.
name
,
test
.
run
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment