@@ -41,9 +41,9 @@ type SsoProviderClient<
4141struct AuthFields {
4242 client_id : String ,
4343 client_secret : String ,
44- auth_url : String ,
45- token_url : String ,
46- userinfo_url : String ,
44+ auth_endpoint : String ,
45+ token_endpoint : String ,
46+ userinfo_endpoint : String ,
4747 redirect_url : String ,
4848 scopes : Vec < Scope > ,
4949}
@@ -63,20 +63,20 @@ fn parse_auth_fields(state: &mut State<'_>) -> Result<AuthFields, VmError> {
6363 . as_string ( )
6464 . unwrap ( )
6565 . to_string ( ) ;
66- let auth_url = fields
67- . get ( & state. intern_static ( "auth_url " ) )
66+ let auth_endpoint = fields
67+ . get ( & state. intern_static ( "auth_endpoint " ) )
6868 . unwrap ( )
6969 . as_string ( )
7070 . unwrap ( )
7171 . to_string ( ) ;
72- let token_url = fields
73- . get ( & state. intern_static ( "token_url " ) )
72+ let token_endpoint = fields
73+ . get ( & state. intern_static ( "token_endpoint " ) )
7474 . unwrap ( )
7575 . as_string ( )
7676 . unwrap ( )
7777 . to_string ( ) ;
78- let userinfo_url = fields
79- . get ( & state. intern_static ( "userinfo_url " ) )
78+ let userinfo_endpoint = fields
79+ . get ( & state. intern_static ( "userinfo_endpoint " ) )
8080 . unwrap ( )
8181 . as_string ( )
8282 . unwrap ( )
@@ -101,9 +101,9 @@ fn parse_auth_fields(state: &mut State<'_>) -> Result<AuthFields, VmError> {
101101 Ok ( AuthFields {
102102 client_id,
103103 client_secret,
104- auth_url ,
105- token_url ,
106- userinfo_url ,
104+ auth_endpoint ,
105+ token_endpoint ,
106+ userinfo_endpoint ,
107107 redirect_url,
108108 scopes,
109109 } )
@@ -113,13 +113,14 @@ fn parse_auth_fields(state: &mut State<'_>) -> Result<AuthFields, VmError> {
113113}
114114
115115fn get_client ( fields : AuthFields ) -> SsoProviderClient {
116- let auth_url = AuthUrl :: new ( fields. auth_url ) . expect ( "Invalid authorization endpoint URL" ) ;
117- let token_url = TokenUrl :: new ( fields. token_url ) . expect ( "Invalid token endpoint URL" ) ;
116+ let auth_endpoint =
117+ AuthUrl :: new ( fields. auth_endpoint ) . expect ( "Invalid authorization endpoint URL" ) ;
118+ let token_endpoint = TokenUrl :: new ( fields. token_endpoint ) . expect ( "Invalid token endpoint URL" ) ;
118119
119120 BasicClient :: new ( ClientId :: new ( fields. client_id ) )
120121 . set_client_secret ( ClientSecret :: new ( fields. client_secret ) )
121- . set_auth_uri ( auth_url )
122- . set_token_uri ( token_url )
122+ . set_auth_uri ( auth_endpoint )
123+ . set_token_uri ( token_endpoint )
123124 . set_redirect_uri ( RedirectUrl :: new ( fields. redirect_url ) . expect ( "Invalid redirect URL" ) )
124125}
125126
@@ -170,7 +171,7 @@ fn verify<'gc>(state: &mut State<'gc>, args: Vec<Value<'gc>>) -> Result<Value<'g
170171 . ok_or_else ( || VmError :: RuntimeError ( "verify() requires 'code' keyword argument" . into ( ) ) ) ?;
171172
172173 let mut fields = parse_auth_fields ( state) ?;
173- let userinfo_url = mem:: take ( & mut fields. userinfo_url ) ;
174+ let userinfo_endpoint = mem:: take ( & mut fields. userinfo_endpoint ) ;
174175
175176 let http_client = reqwest:: ClientBuilder :: new ( )
176177 // Following redirects opens the client up to SSRF vulnerabilities.
@@ -187,7 +188,7 @@ fn verify<'gc>(state: &mut State<'gc>, args: Vec<Value<'gc>>) -> Result<Value<'g
187188 let access_token = token. access_token ( ) . secret ( ) . to_owned ( ) ;
188189
189190 let response = http_client
190- . get ( userinfo_url )
191+ . get ( userinfo_endpoint )
191192 . header ( "Authorization" , format ! ( "Bearer {}" , access_token) )
192193 . send ( )
193194 . await
0 commit comments