Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1851 add oura ring api key #1461

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Conversation

sandradeng20
Copy link
Contributor

add oura ring api key to twa account mapping

Comment on lines +98 to +103
private TokenIntrospectionResponse getTokenIntrospectResponse(HttpServletRequest httpRequest) {
AuthorizationRequest request = new AuthorizationRequest();
AuthorizationResponse response = authzClient.authorization(httpRequest.getHeader("Authorization").replace("Bearer ", "")).authorize(request);

} else if (request.getRequestURI().contains("getPhoneIds")) {
validateInputGetPhoneIds(requestParams);
JSONArray phoneIds = kgQueryClient.getPhoneIds(requestParams.getString("userId"));
JSONObject result = new JSONObject();
result.put("PhoneIds", phoneIds);
result.put("Comment", "Phone ids are retrieved.");
return result;
TokenIntrospectionResponse tokenIntrospectionResponse = authzClient.protection().introspectRequestingPartyToken(response.getToken());
return tokenIntrospectionResponse;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the purpose of this method? I think the /userinfo endpoint already validates the token?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is to check whether the token has the permission to perform the operations (eg. registerPhone, getPhoneIds, registerOuraRing), although we now allow all users to perform these three operations.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, just wondering if there is a way to only contact KeyCloak once instead of twice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants