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

adding api manager keycloak keymanager code #1

Merged
merged 8 commits into from
Apr 10, 2020

Conversation

gayanlggd
Copy link
Contributor

Purpose

Adding initial code base for api manager keycloak keymanager component.

Goals

Provision Keycloak as a third party key manager for WSO2 APIM 2.6

Approach

Keycloak Client is written extending the AbstractKeyManager class.

User stories

Adopting a third party key manager, Keycloak for API Manager 2.6.0

Release note

Third party keymanager implementation for API Manager and Keycloak.

Documentation

Will be added in the future.

Training

N/A

Certification

N/A. Does not lie on the major flaws in APIM since it is custom implementation.

Marketing

N/A

Automation tests

N/A

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

N/A

Migrations (if applicable)

N/A

Test environment

JDK 8

Learning

Keycloak official documentation
https://www.keycloak.org/docs-api/5.0/rest-api/index.html#_clients_resource

@CLAassistant
Copy link

CLAassistant commented Apr 5, 2020

CLA assistant check
All committers have signed the CLA.

}
// for(JSONValue value : (JSONArray)responseMap.get(KeycloakConstants.CLIENT_REDIRECT_URIS)){
// uris.add(value.asString());
// }
Copy link

Choose a reason for hiding this comment

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

shall we remove this if not needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I will remove it.

if((Boolean) responseMap.get(KeycloakConstants.GRANT_TYPE_CLIENT_CREDENTIALS_KEYCLOAK)){
grantTypeList.add(KeycloakConstants.GRANT_TYPE_CLIENT_CREDENTIALS);
}
if((Boolean) responseMap.get(KeycloakConstants.GRANT_TYPE_PASSWORD_KEYCLOAK)){
Copy link

Choose a reason for hiding this comment

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

seems the code if not formatted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Will reformat.

} catch (IOException e) {
handleException("Error while reading response body", e);
} finally {
closeResources(null, httpClient);
Copy link

Choose a reason for hiding this comment

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

we can use try-resource instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will try this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact, the closable resources defined in try are final. I cannot initialize my buffered reader there since I need to reassign the entity value from HTTP response to it. To keep the code consistent, I will keep using the finally block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have used multiple try blocks and accommodated this recommendation.

@chamilaadhi chamilaadhi merged commit 218d49a into wso2-extensions:master Apr 10, 2020
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.

None yet

4 participants