3
votes

I'm new to WSO2 products and SOA but this is what my superiors assigned me to do. They wanted me to install, based on the requirements, WSO2 APIM, IS, and DSS products. In DSS they wanted me to create a service that would use a MySQL table as the datasource and use an URI template. I have done that successfully and it is working testing it using cURL. After that they wanted me to create an API in APIM and use that DSS service as an endpoint. I've also done that successfully by following documentation coming from WSO2 site. Next is they wanted me to use Identity Server's OAuth2 to authenticate users that will use the API, so what I did was to use APIM as the gateway and the Key Manager as the Identity Server and used WSO2 documentation https://docs.wso2.com/display/CLUSTER420/Configuring+WSO2+Identity+Server+as+the+Key+Manager. I've done that properly and I've already tried getting user access token (Generating access tokens with user credentials) by using the consumer key and secret. I got the access token but when testing it using cURL with the Access Token given by IS

curl -i -H "Accept: application/json" "Authorization: Bearer
 h6kdYQgHVVQ19yOaf4lnDgw3NQga" -X GET
 http://hostip:8280/SampleDSS/1.0/users

I get an error

curl: (6) Could not resolve host: 
Authorization HTTP/1.1 401
Unauthorized WWW-Authenticate: OAuth2 realm="WSO2 API Manager"
Access-Control-Allow-Headers: authorization,Access-Control-Allow-Origin,Content-Type
Content-Type: application/xml; charset=UTF-8 Date: Wed, 06 Aug 2014 03:45:04 GMT
Server: WSO2-PassThrough-HTTP Transfer-Encoding: chunked

<ams:fault xmlns:ams="http://wso2.org/apimanager/security">
  <ams:code>900902</ams:code>
  <ams:message>Missing Credentials</ams:message>
  <ams:description>Required OAuth credentials not provided</ams:description>
</ams:fault>

Pardon me if this is a basic question but I'm a bit stuck on this.

Another thing is APIM is shipped with a Key Management Server component that handles security and key related operations. This can be configured to authenticate users against a defined user store or multiple user stores and authorization is based on OAuth 2.0. Now is there really a need to use Identity Server as the Key Manager or I just need another instance to APIM and use it as the key manager? I'm asking this because I think it's too much to use Identity Server just for OAuth2 if there is OAuth2 authentication with APIM.

Thank you very much for the help. Please do understand that I'm new to this with only 1 month of learning all of this. Some of my terms might be incorrect and if there are please let me know.

Again thank you very much, Drew

1

1 Answers

3
votes

try with this.

     curl -v -H "Authorization: Bearer h6kdYQgHVVQ19yOaf4lnDgw3NQga, Accept: application/json" -X GET http://hostip:8280/SampleDSS/1.0/users