REST API for retrieving OAuth access tokens
As preparation for an UI to retrieve OAuth tokens, a new endpoint
for the account REST API is added that returns a previously
obtained OAuth token:
GET /a/accounts/self/oauthtoken
The response will be 200 OK in case a token is available and the
response will contain a JSON body of the form
)]}'
{
"username": "johndow",
"resource_host": "git.example.org",
"access_token": "eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOi...",
"providerId": "oauth-plugin:oauth-provider",
"expires_at": "922337203775",
"type": "bearer"
}
If there is no token available, or the token has already expired,
404 is returned. Attempts to retrieve a token of another user are
rejected with 403 Forbidden.
Change-Id: I6ddb825890e88c49bd8c5e66b8c5508cef7df347
Signed-off-by: Michael Ochmann <michael.ochmann@sap.com>
This commit is contained in:
@@ -64,6 +64,8 @@ public class Module extends RestApiModule {
|
||||
get(SSH_KEY_KIND).to(GetSshKey.class);
|
||||
delete(SSH_KEY_KIND).to(DeleteSshKey.class);
|
||||
|
||||
get(ACCOUNT_KIND, "oauthtoken").to(GetOAuthToken.class);
|
||||
|
||||
get(ACCOUNT_KIND, "avatar").to(GetAvatar.class);
|
||||
get(ACCOUNT_KIND, "avatar.change.url").to(GetAvatarChangeUrl.class);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user