Skip to content

Commit

Permalink
Merge pull request #8 from Biruntha/master
Browse files Browse the repository at this point in the history
Make client secret as optional parameter
  • Loading branch information
keerthu authored Apr 16, 2018
2 parents 43f0a17 + d146088 commit fa17a58
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 2 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ You have connected WSO2 API Manager with a third-party Okta authorization server

Fill out the required parameters and click Save. You will be redirected to the page that has application and access token details.

>>**Note :** If you have not provide consumer secret, the access token will not be generated.

>>**Note :** Please make a note of this Consumer Secret and Access Token values, as it will be the only one time that you will be able to view it.

2. cURL command :
Expand Down
Binary file modified docs/images/map_application_details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.okta.client</groupId>
<artifactId>OKTA-OAuth-Client</artifactId>
<version>1.0.2-SNAPSHOT</version>
<version>1.0.2</version>
<packaging>bundle</packaging>
<name>Client implementation to integrate with Okta Authorization Server</name>
<url>http://wso2.org</url>
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/org/wso2/okta/client/OktaOAuthClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,12 @@ public AccessTokenRequest buildAccessTokenRequestFromOAuthApp(
tokenRequest = new AccessTokenRequest();
}
String clientName = oAuthApplication.getClientName();
if (oAuthApplication.getClientId() == null || oAuthApplication.getClientSecret() == null) {
throw new APIManagementException(String.format("Consumer key or Consumer Secret missing for the " +
"Application: %s", clientName));
if (oAuthApplication.getClientId() == null) {
throw new APIManagementException(String.format("Consumer key is missing for the Application: %s",
clientName));
}
if(oAuthApplication.getClientSecret() == null) {
log.error(String.format("Consumer Secret is missing for the Application: %s", clientName));
}
tokenRequest.setClientId(oAuthApplication.getClientId());
tokenRequest.setClientSecret(oAuthApplication.getClientSecret());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,18 +262,18 @@ jagg.template("application/application-keys", function(inputs, outputs, jagg) {
<input type="text" required class="form-control ConsumerKey" title="ConsumerKey is mandatory field" id="ConsumerKey" name="ConsumerKey" autofocus="autofocus" placeholder="<%=i18n.localize("Consumer Key")%>" />
</div>
<div class="form-group">
<label class="" for="ConsumerKey"><%=i18n.localize("Consumer Secret")%> <span class="requiredAstrix">*</span></label>
<input type="text" required class="form-control MapAppConsumerSecret" title="ConsumerSecret is mandatory field" id="MapAppConsumerSecret" name="MapAppConsumerSecret" placeholder="<%=i18n.localize("Consumer Secret")%>" value="{{MapAppConsumerSecret}}"/>
<label class="" for="ConsumerKey"><%=i18n.localize("Consumer Secret")%></label>
<input type="text" class="form-control MapAppConsumerSecret" title="ConsumerSecret is mandatory field" id="MapAppConsumerSecret" name="MapAppConsumerSecret" placeholder="<%=i18n.localize("Consumer Secret")%>" value="{{MapAppConsumerSecret}}"/>
</div>

<div class="form-group">
<label class="" for="ConsumerKey"><%=i18n.localize("Token Scope")%> <span class="requiredAstrix">*</span></label>
<input type="text" required class="form-control token_scope" title="Token Scope is mandatory field" id="token_scope" name="token_scope" autofocus="autofocus" value="{{token_scope}}" placeholder="Token Scope" />
<label class="" for="ConsumerKey"><%=i18n.localize("Token Scope")%></label>
<input type="text" class="form-control token_scope" title="Token Scope is mandatory field" id="token_scope" name="token_scope" autofocus="autofocus" value="{{token_scope}}" placeholder="Token Scope" />
</div>

<div class="form-group">
<label class="" for="ConsumerKey"><%=i18n.localize("Token Grant Type")%> <span class="requiredAstrix">*</span></label>
<input type="text" required class="form-control token_grantType" title="Token Grant Type is mandatory field" id="token_grantType" autofocus="autofocus" value="{{token_grantType}}" name="token_grantType" placeholder="Token Grant Type" />
<label class="" for="ConsumerKey"><%=i18n.localize("Token Grant Type")%></label>
<input type="text" class="form-control token_grantType" title="Token Grant Type is mandatory field" id="token_grantType" autofocus="autofocus" value="{{token_grantType}}" name="token_grantType" placeholder="Token Grant Type" />
</div>
<div class="form-group">
<button class="btn btn-primary provide_keys_save"><%=i18n.localize("Save")%></button>
Expand Down

0 comments on commit fa17a58

Please sign in to comment.