Skip to content
This repository has been archived by the owner on Dec 20, 2022. It is now read-only.

Commit

Permalink
Add test case for mismatch cert and cnf
Browse files Browse the repository at this point in the history
  • Loading branch information
kyfujisa committed Apr 6, 2020
1 parent 43f2cf4 commit 930b45d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions role/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,36 @@ func Test_rtp_validateCertificateBoundAccessToken(t *testing.T) {
},
wantErr: true,
},
{
name: "verify certificate bound accecss token fail, invalid confirmation claim",
fields: fields{
enableMTLSCertificateBoundAccessToken: true,
},
args: args{
cert: func() *x509.Certificate {
return LoadX509CertFromDisk("./asserts/dummyClient.crt")
}(),
claims: &ZTSAccessTokenClaim{
BaseClaim: BaseClaim{
StandardClaims: jwt.StandardClaims{
Subject: "domain.tenant.service",
IssuedAt: 1585122381,
ExpiresAt: 9999999999,
Issuer: "https://zts.athenz.io",
Audience: "domain.provider",
},
},
AuthTime: 1585122381,
Version: 1,
ClientID: "domain.tenant.service",
UserID: "domain.tenant.service",
Scope: []string{"admin", "user"},
// cnf when cert thumbprint is "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
Confirm: map[string]string{"x5t#S256": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo"},
},
},
wantErr: true,
},
{
name: "verify certificate bound accecss token fail, no confirmation claim",
fields: fields{
Expand Down

0 comments on commit 930b45d

Please sign in to comment.