|
| 1 | +import io |
1 | 2 | import json |
2 | 3 | import os |
3 | 4 | from http.cookies import SimpleCookie |
4 | 5 | from urllib.parse import parse_qs |
5 | 6 | from urllib.parse import urlparse |
6 | 7 |
|
7 | 8 | import pytest |
| 9 | +import yaml |
8 | 10 | from cryptojwt.jwt import utc_time_sans_frac |
9 | 11 | from cryptojwt.utils import as_bytes |
10 | 12 | from cryptojwt.utils import b64e |
@@ -148,6 +150,38 @@ def get_cookie_value(cookie=None, cookie_name=None): |
148 | 150 | return None |
149 | 151 |
|
150 | 152 |
|
| 153 | +client_yaml = """ |
| 154 | +oidc_clients: |
| 155 | + client_1: |
| 156 | + "client_secret": 'hemligt' |
| 157 | + "redirect_uris": |
| 158 | + - ['https://example.com/cb', ''] |
| 159 | + "client_salt": "salted" |
| 160 | + 'token_endpoint_auth_method': 'client_secret_post' |
| 161 | + 'response_types': |
| 162 | + - 'code' |
| 163 | + - 'token' |
| 164 | + - 'code id_token' |
| 165 | + - 'id_token' |
| 166 | + - 'code id_token token' |
| 167 | + client2: |
| 168 | + client_secret: "spraket" |
| 169 | + redirect_uris: |
| 170 | + - ['https://app1.example.net/foo', ''] |
| 171 | + - ['https://app2.example.net/bar', ''] |
| 172 | + response_types: |
| 173 | + - code |
| 174 | + client3: |
| 175 | + client_secret: '2222222222222222222222222222222222222222' |
| 176 | + redirect_uris: |
| 177 | + - ['https://127.0.0.1:8090/authz_cb/bobcat', ''] |
| 178 | + post_logout_redirect_uris: |
| 179 | + - ['https://openidconnect.net/', ''] |
| 180 | + response_types: |
| 181 | + - code |
| 182 | +""" |
| 183 | + |
| 184 | + |
151 | 185 | class TestEndpoint(object): |
152 | 186 | @pytest.fixture(autouse=True) |
153 | 187 | def create_endpoint(self): |
@@ -233,14 +267,8 @@ def create_endpoint(self): |
233 | 267 | } |
234 | 268 | } |
235 | 269 | endpoint_context = EndpointContext(conf) |
236 | | - endpoint_context.cdb['client_1'] = { |
237 | | - "client_secret": 'hemligt', |
238 | | - "redirect_uris": [("https://example.com/cb", None)], |
239 | | - "client_salt": "salted", |
240 | | - 'token_endpoint_auth_method': 'client_secret_post', |
241 | | - 'response_types': ['code', 'token', 'code id_token', 'id_token', |
242 | | - 'code id_token token'] |
243 | | - } |
| 270 | + _clients = yaml.load(io.StringIO(client_yaml)) |
| 271 | + endpoint_context.cdb = _clients['oidc_clients'] |
244 | 272 | endpoint_context.keyjar.import_jwks( |
245 | 273 | endpoint_context.keyjar.export_jwks(True, ''), conf['issuer']) |
246 | 274 | self.endpoint = Authorization(endpoint_context) |
@@ -731,6 +759,8 @@ def test_setup_auth_login_hint2acrs(self): |
731 | 759 | assert isinstance(res['method'], NoAuthn) |
732 | 760 | assert res['method'].user == 'knoll' |
733 | 761 |
|
| 762 | + def test_post_logout_uri(self): |
| 763 | + pass |
734 | 764 |
|
735 | 765 | def test_inputs(): |
736 | 766 | elems = inputs({'foo': 'bar', 'home': 'stead'}) |
|
0 commit comments