-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Currently, this is the typical code setup inside a web applications' routes() method:
use web\auth\SessionBased;
use web\auth\oauth\{OAuth2Flow, BySecret};
$flow= new OAuth2Flow(
'http://localhost:8443/oauth/common/authorize',
'http://localhost:8443/oauth/common/token',
new BySecret('613aacd1f95ce7ee1b04', '...'),
'/',
['user'],
);
$auth= new SessionBased($flow, $sessions, function($client) use($users) {
$me= $client->fetch('http://localhost:8443/graph/me')->value();
return $users->upsert([
'handle' => $me['id'],
'name' => $me['name'],
// continues mapping fields, shortened for brevity
]);
});
return ['/' => $auth->required($frontend)];If I want to make this configurable and integrate well with several services, there's a lot to do:
- 2 separate URLs for authorize and token endpoints
- Another one to choose between the credentials using BySecret (client ID and secret) or ByCertificate (client ID, thumbprint and certificate)
- Depending on the above, 2 or 3 more configuration values for the credentials
- An additional one for the scopes
- Another one for the userinfo endpoint
- ...and finally something to map the fields returned by this userinfo endpoint
👉 This boils down to almost 10 configuration options that have to be set in order to get an OAuth workflow running!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels