stable
Clone or download
Part of story #14714: be an OpenID Connect provider To test you need an access token with the 'openid' scope, the 'profile' scope and optionally also the 'email' scope (if the usage of PKCE is forced, add the mandatory parameters): 1. In the project admin create an OAuth2 app (note the ID and the given secret) 2. Access the authorize page at the URL https://tuleap.example.com/oauth2/authorize?client_id=<client_id>&scope=openid%20profile&response_type=code&redirect_uri=<redirect_uri> 3. Quickly retrieve (it is valid only 1 minute) the authorization code from the URL 4. Exchange the authorization code for an access token and an ID token: shell> curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' \ --user '<client_id>:<client_secret>' \ --data 'grant_type=authorization_code&redirect_uri=<redirect_uri>&code=<authorization_code>' \ https://tuleap.example.com/oauth2/token 5. Access the UserInfo endpoint with the given Access token: shell> curl -H 'Authorization: Bearer <access_token>' https://tuleap.example.com/oauth2/userinfo 6. The response will be a JSON object containing the "sub" claim and the other claims for user profile [0]. If the 'email' scope was used, it will also list "email" and "email_verified" claims. [0] https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims Change-Id: I6b2898754e93d7f26799ab998056bab0e5b5330d
Modified Files
Name | ||||
---|---|---|---|---|
A | plugins/oauth2_server/include/OpenIDConnect/Scope/OpenIDConnectProfileScope.php | +104 | −0 | Go to diff View file |
M | plugins/oauth2_server/include/User/UserInfoController.php | +10 | −6 | Go to diff View file |
M | plugins/oauth2_server/include/User/UserInfoResponseRepresentation.php | +49 | −23 | Go to diff View file |
M | plugins/oauth2_server/include/oauth2_serverPlugin.php | +3 | −1 | Go to diff View file |
A | plugins/oauth2_server/phpunit/OpenIDConnect/Scope/OpenIDConnectProfileScopeTest.php | +34 | −0 | Go to diff View file |
M | plugins/oauth2_server/phpunit/User/UserInfoControllerTest.php | +37 | −24 | Go to diff View file |
A | plugins/oauth2_server/phpunit/User/UserInfoResponseRepresentationTest.php | +92 | −0 | Go to diff View file |
M | plugins/oauth2_server/site-content/fr_FR/LC_MESSAGES/tuleap-oauth2_server.po | +10 | −0 | Go to diff View file |
M | tests/lib/Builders/UserTestBuilder.php | +6 | −0 | Go to diff View file |
D | tests/phpcs/TuleapCodingStandard/Tuleap/OAuth2Server/User/UserInfoResponseRepresentationTest.php | +0 | −48 | Go to diff View file |