@@ -45,9 +45,7 @@ test_without_resource_servers(_) ->
4545 #{} = oauth2_schema :translate_resource_servers ([]).
4646
4747test_without_endpoint_params (_ ) ->
48- #{} = translate_endpoint_params (" discovery_endpoint_params" , []),
49- #{} = translate_endpoint_params (" token_endpoint_params" , []),
50- #{} = translate_endpoint_params (" authorization_endpoint_params" , []).
48+ #{} = translate_endpoint_params (" oauth_discovery_endpoint_params" , []).
5149
5250test_with_invalid_endpoint_params (_ ) ->
5351 try translate_endpoint_params (" discovery_endpoint_params" , [
@@ -60,16 +58,10 @@ test_with_invalid_endpoint_params(_) ->
6058test_with_endpoint_params (_ ) ->
6159 Conf = [
6260 {[" auth_oauth2" ," discovery_endpoint_params" ," param1" ], " some-value1" },
63- {[" auth_oauth2" ," discovery_endpoint_params" ," param2" ], " some-value2" },
64- {[" auth_oauth2" ," token_endpoint_params" ," audience" ], " some-audience" },
65- {[" auth_oauth2" ," authorization_endpoint_params" ," resource" ], " some-resource" }
61+ {[" auth_oauth2" ," discovery_endpoint_params" ," param2" ], " some-value2" }
6662 ],
6763 #{ <<" param1" >> := <<" some-value1" >>, <<" param2" >> := <<" some-value2" >> } =
68- translate_endpoint_params (" discovery_endpoint_params" , Conf ),
69- #{ <<" audience" >> := <<" some-audience" >>} =
70- translate_endpoint_params (" token_endpoint_params" , Conf ),
71- #{ <<" resource" >> := <<" some-resource" >>} =
72- translate_endpoint_params (" authorization_endpoint_params" , Conf ).
64+ translate_endpoint_params (" discovery_endpoint_params" , Conf ).
7365
7466test_invalid_oauth_providers_endpoint_params (_ ) ->
7567 try oauth2_schema :translate_oauth_providers ([
@@ -83,17 +75,15 @@ test_without_oauth_providers_with_endpoint_params(_) ->
8375 Conf = [
8476 {[" auth_oauth2" ," oauth_providers" , " A" , " discovery_endpoint_params" ," param1" ], " some-value1" },
8577 {[" auth_oauth2" ," oauth_providers" , " A" , " discovery_endpoint_params" ," param2" ], " some-value2" },
86- {[" auth_oauth2" ," oauth_providers" , " B" , " token_endpoint_params" ," audience" ], " some-audience" },
87- {[" auth_oauth2" ," oauth_providers" , " C" , " authorization_endpoint_params" ," resource" ], " some-resource" }
78+ {[" auth_oauth2" ," oauth_providers" , " B" , " discovery_endpoint_params" ," param3" ], " some-value3" }
8879 ],
8980
9081 #{
9182 <<" A" >> := [{discovery_endpoint_params ,
9283 #{ <<" param1" >> := <<" some-value1" >>, <<" param2" >> := <<" some-value2" >> }}],
93- <<" B" >> := [{token_endpoint_params ,
94- #{ <<" audience" >> := <<" some-audience" >>}}],
95- <<" C" >> := [{authorization_endpoint_params ,
96- #{ <<" resource" >> := <<" some-resource" >>}}]
84+ <<" B" >> := [{discovery_endpoint_params ,
85+ #{ <<" param3" >> := <<" some-value3" >>}}
86+ ]
9787 } = translate_oauth_providers (Conf ).
9888
9989test_with_one_oauth_provider (_ ) ->
@@ -110,11 +100,13 @@ test_with_one_resource_server(_) ->
110100
111101test_with_many_oauth_providers (_ ) ->
112102 Conf = [{[" auth_oauth2" ," oauth_providers" ," keycloak" ," issuer" ]," https://keycloak" },
113- {[" auth_oauth2" ," oauth_providers" ," uaa" ," issuer" ]," https://uaa" }
103+ {[" auth_oauth2" ," oauth_providers" ," uaa" ," issuer" ]," https://uaa" },
104+ {[" auth_oauth2" ," oauth_providers" ," uaa" ," discovery_endpoint_path" ]," /some-path" }
114105 ],
115- #{<<" keycloak" >> := [{issuer , <<" https://keycloak" >>}
106+ #{<<" keycloak" >> := [{issuer , <<" https://keycloak" >>}
116107 ],
117- <<" uaa" >> := [{issuer , <<" https://uaa" >>}
108+ <<" uaa" >> := [{issuer , <<" https://uaa" >>},
109+ {discovery_endpoint_path , <<" /some-path" >>}
118110 ]
119111 } = oauth2_schema :translate_oauth_providers (Conf ).
120112
0 commit comments