-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integration test for client_secret_jwt and private_key_jwt: the created
JWT is validated at the AS's token endpoint; some claims are passed in the access token to the client to further check them at the RS; the x5t header is not tested (yet)
- Loading branch information
Johannes Koch
committed
Sep 20, 2022
1 parent
f6643f0
commit 949da26
Showing
4 changed files
with
318 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
server { | ||
hosts = ["*:8080"] | ||
|
||
api { | ||
endpoint "/csj" { | ||
proxy { | ||
backend = "csj" | ||
} | ||
} | ||
|
||
endpoint "/csj_error" { | ||
proxy { | ||
backend = "csj_error" | ||
} | ||
} | ||
|
||
endpoint "/pkj" { | ||
proxy { | ||
backend = "pkj" | ||
} | ||
} | ||
|
||
endpoint "/pkj_error" { | ||
proxy { | ||
backend = "pkj_error" | ||
} | ||
} | ||
} | ||
} | ||
|
||
definitions { | ||
backend "csj" { | ||
origin = "{{.rsOrigin}}" | ||
|
||
oauth2 { | ||
token_endpoint = "http://1.1.1.1:9999/token/csj" | ||
grant_type = "client_credentials" | ||
client_id = "my_clid" | ||
client_secret = "my_cls" | ||
token_endpoint_auth_method = "client_secret_jwt" | ||
authn_signature_algorithm = "HS256" | ||
authn_ttl = "10s" | ||
} | ||
} | ||
|
||
backend "csj_error" { | ||
origin = "{{.rsOrigin}}" | ||
|
||
oauth2 { | ||
token_endpoint = "http://1.1.1.1:9999/token/csj/error" | ||
grant_type = "client_credentials" | ||
client_id = "my_clid" | ||
client_secret = "my_cls" | ||
token_endpoint_auth_method = "client_secret_jwt" | ||
authn_signature_algorithm = "HS256" | ||
authn_ttl = "10s" | ||
} | ||
} | ||
|
||
backend "pkj" { | ||
origin = "{{.rsOrigin}}" | ||
|
||
oauth2 { | ||
token_endpoint = "http://1.1.1.1:9999/token/pkj" | ||
grant_type = "client_credentials" | ||
client_id = "my_clid" | ||
token_endpoint_auth_method = "private_key_jwt" | ||
authn_key_file = "./testdata/oauth2/pkcs8.key" | ||
authn_signature_algorithm = "RS256" | ||
authn_ttl = "10s" | ||
authn_aud_claim = "some explicit value" | ||
} | ||
} | ||
|
||
backend "pkj_error" { | ||
origin = "{{.rsOrigin}}" | ||
|
||
oauth2 { | ||
token_endpoint = "http://1.1.1.1:9999/token/pkj/error" | ||
grant_type = "client_credentials" | ||
client_id = "my_clid" | ||
token_endpoint_auth_method = "private_key_jwt" | ||
authn_key_file = "./testdata/oauth2/pkcs8.key" | ||
authn_signature_algorithm = "RS256" | ||
authn_ttl = "10s" | ||
} | ||
} | ||
|
||
jwt "csj" { | ||
token_value = request.form_body.client_assertion[0] | ||
signature_algorithm = "HS256" | ||
key = "my_cls" | ||
claims = { | ||
iss = "my_clid" | ||
sub = "my_clid" | ||
aud = "http://1.1.1.1:9999/token/csj" | ||
} | ||
required_claims = ["iat", "exp", "jti"] | ||
} | ||
|
||
jwt "csj_error" { | ||
token_value = request.form_body.client_assertion[0] | ||
signature_algorithm = "HS256" | ||
key = "wrong key" | ||
} | ||
|
||
jwt "pkj" { | ||
token_value = request.form_body.client_assertion[0] | ||
signature_algorithm = "RS256" | ||
key_file = "./testdata/oauth2/certificate.pem" | ||
claims = { | ||
iss = "my_clid" | ||
sub = "my_clid" | ||
aud = "some explicit value" | ||
} | ||
required_claims = ["iat", "exp", "jti"] | ||
} | ||
|
||
jwt "pkj_error" { | ||
token_value = request.form_body.client_assertion[0] | ||
signature_algorithm = "HS256" | ||
key = "wrong key" | ||
} | ||
} | ||
|
||
server { | ||
hosts = ["*:9999"] | ||
|
||
api { | ||
endpoint "/token/csj" { | ||
access_control = ["csj"] | ||
|
||
response { | ||
json_body = { | ||
access_token = "${request.context.csj.iat} ${request.context.csj.exp} ${request.context.csj.jti}" | ||
expires_in = 60 | ||
} | ||
} | ||
} | ||
|
||
endpoint "/token/csj/error" { | ||
access_control = ["csj_error"] | ||
|
||
response { | ||
json_body = { | ||
access_token = "qoebnqeb" | ||
expires_in = 60 | ||
} | ||
} | ||
} | ||
|
||
endpoint "/token/pkj" { | ||
access_control = ["pkj"] | ||
|
||
response { | ||
json_body = { | ||
access_token = "${request.context.pkj.iat} ${request.context.pkj.exp} ${request.context.pkj.jti}" | ||
expires_in = 60 | ||
} | ||
} | ||
} | ||
|
||
endpoint "/token/pkj/error" { | ||
access_control = ["pkj_error"] | ||
|
||
response { | ||
json_body = { | ||
access_token = "qoebnqeb" | ||
expires_in = 60 | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIDazCCAlOgAwIBAgIUUc60oTARAfBxsH/kWM1V/hwVvWEwDQYJKoZIhvcNAQEL | ||
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM | ||
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMTA5MDYwOTUyMzFaFw00OTAx | ||
MjIwOTUyMzFaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw | ||
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB | ||
AQUAA4IBDwAwggEKAoIBAQDE65urxA3yAFUTAg0J9U2+ZkCE75kt4plqlPfw7JmS | ||
qb7wFSz3xwEWbNQKK43ZwWuO6GhEBePZhX/eW7RLL8beScsVsZJ+4n6hm7Bg0MDe | ||
VqwYk1midESwBQl17WEjS4ltx4nNwkOJ9THbMZHl4JFAqXHGJX+KsTL7Bn79833G | ||
u57XwHKQvPodAFe7iaFzXur2oBm3HeEsFHFDCRkZvG6aBgZ09e6HZhXzZp3DXzCJ | ||
kheBU69rCBdC+VUOeNJouoTdET9uRWZaQThNFC4ViGqgQVXnREEgsRaXBQeo2CAv | ||
3NTDb9F1bW5PJAm0QxGLPpaCJZqrSX1KSaWtIUDZIMDnAgMBAAGjUzBRMB0GA1Ud | ||
DgQWBBTB0Uww2YLLyIq7GkUXgIK3prhOIDAfBgNVHSMEGDAWgBTB0Uww2YLLyIq7 | ||
GkUXgIK3prhOIDAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQC4 | ||
M1e8o0qGN51yn5yAoiFB68+g45XhGr8ebFI66nSs35/f38xbjG4RQVLiJHdztOS1 | ||
axaUORssN5KycvNGZUv89LEd7hw9a8H9Nj/T80M4u3e5kGYwFHc/1su/CoT20tmT | ||
VkXOnjnOV++5xK8feLt9lN9d5PFeSE+RnByfdtN3GeKE2JWr5h8Ld6gVVIepilSG | ||
jw7pmfSZvtCcnAHY4jpyW6Qfujp/m1XczLnzcDxE6DF9M7aVePH2dQW7t1zq5J1A | ||
S7O+snPtz4NKLfRM+1xtVH7zig9zlc/gnqCJMy72howXP0daUmcJfEsPh7Eos50a | ||
uc7Gh5RWuHDesWBWtAJF | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQDE65urxA3yAFUT | ||
Ag0J9U2+ZkCE75kt4plqlPfw7JmSqb7wFSz3xwEWbNQKK43ZwWuO6GhEBePZhX/e |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