I have configured WSO2 API Manager integrated with WSO2 Identity server.
I have created some API's and created some scopes , roles to it..
But currently i cant see any scopes in the applications ,when i try to generate key..
What could be the reason? I have been changing many configuration files for deploying this in EC2.Could any of them cause this issue?I have no errros in console..how can i debug this?
Only the scopes which are assigned to API resources will be shown there.
As #Bhathiya mentioned we need set scope on resource of API.
Please refer this article for more details on how to set scope for resource. [Article] How to Use OAuth 2.0 Scopes to Provide Role-Based Authorization to APIs Exposed via WSO2 API Manager by Nadeesha Gamage.
I have tried myself and it worked. PFA Screenprint.
1. Set Scope on resource.
2. Scope was available to generate key
I have set the roles to user while testing. In your case you need define roles in integrated wso2 identity server.
Related
We are using WSO2IS as IAM server , roles and Users are managed in WSO2IS. WSO2EI WILL be integration server , exposing private APIs
What would be the right way to implement role based access control using , like some set of APIs only to be accessed by users with specific groups. How can I implement this most simplest way ? Is there a requirement of WSO2AM here ?
Thanks
EI is not the ideal way to exposing private oauth secured APIs. Even though you can achieve it with EI, that would be an excessive effort when integrating.
Use API Manager to expose the APIs to your crowd. Configure Identity Server as the Key Manager (Token Manager) of the APIM server. APIM server knows how to talk to the Identity Server to generate and validate access tokens. So there's no explicit effort to integrate the resource server(APIM Gateway) with the authorization server(IAM).
Share the user store between both the servers. (IS and APIM)
Configure IS as the Key Manager of the API server.
Register your API in the publisher/developer portal.
When publishing, you can define role based access restrictions to your API resources from the Publisher portal. (Roe : Scope mapping)
Once you define, IS will always check your roles upon providing an access token for you.
As you've already defined a role : scope mapping, scopes you request in your token generation request, will only be accepted if you (requester) has the expected roles. Therefore, the scope of your token will only be as good as the roles you've got assigned to yourself. Now, as the API resources you've published require a defined set of scopes, not all the access tokens will be accepted when trying to access the APIs. Only the ones with the expected scopes.
Configure IS-KM with APIM
Role based scopes
I'm having separate Dotnet Web Service API to authenticate users. How can I configure it with WSO2 API Manager?
I have already configured WSO2 API Manager with external IDP (Keycloak). Is this is what im looking orcan be achieved in different way.
If you are looking for a way to replace your user store(LDAP/AD/JDBC), with your Dotnet service, you might want to write a new custom user store manager extending the CarbonRemoteUserStoreManger class. There, you should invoke your custom APIs to authenticate, retrieve users. Then you can add a secondary/primary user store with your custom user store manager implementation.
If you want to configure your Dotnet service as a Federated IdP in the API Manager server, you might have to write a Custom Federated Authenticator to communicate with your Dotnet service to authenticate the users. There you should be overriding the initiateAuthenticationRequest and processAuthenticationResponse.
Editing the answer with the new context on issue
In order to generate or validate tokens with an external party(Dotnet service), WSO2 needs to know the service contract of that service beforehand. How you fetch that information to the WSO2 APIM server is by writing an extension to the Key Manger service of the WSO2 APIM server.
By default WSO2 APIM has the implementation to talk to its own Key Manager component and the WSO2 Identity Server. But you need to write the logic (request/response templates) to validate tokens with your dotnet service. This is the official documentation for this. These two Medium posts as well are written on that topic.
Blog 1
Blog 2
Basically, you need to write a simple java extension project to the mentioned interface, so that WSO2 knows how to talk to your service. A sample such implementation written for Okta as a Key Manager is pointed here.
Regarding your concern on validating both the token types;
Yes, it's possible using a custom key manager interface as described above. Once you receive the token at the API Manager side, if you can distinguish if the token was issued by your Dotnet service or by WSO2 itself from your Java logic (May be the token length), then your logic should divert the validation request respectively to WSO2 default Key Validation service (Call super()) or to your Dotnet service call. If you can't distinguish between the two tokens just by looking at them, then you can try both the servers to check if either can validate it. (There's a security vulnerability in that.)
Hope this helps.
I am managing my APIs using WSO2 API Mananger.Till now every API were private and can be accessed using an access token.
The new use cases some API's which is purely public. Any one can access them anonymously. Just a GET,POST,PUT wihtout any token/access details should work.
I exposed API's via WSO2 API Manager without any scopes. Tried to access them without any token ;but its not working.It says required oAuth credentails not found.
Is there anything else to do to expose APIs so that they are accessible anonymously?
In the Manage page of publisher, you can set Authentication Type to None for each resource instead of the default value Application and Application User.
We are using WSO2 Identity server and WSO2 API Manager to manage access.
We give scopes to API and assign scopes to roles.
Now the requirement came like From the application , privileges for roles has to be manipulable.
Suppose if there is a Role like Admin in the application , we have to list activities[scopes] against that Role and Super User can change the scopes against that Role.Superuser can create new roles as well.
So we cant predefine which are all the scopes for the particular roles.
How can i address this via WSO2? How to manage privilages via WSO2?
I believe what you want is to manage the permission each role has.
That you can do with RemoteAuthorizationManager SOAP service.
See docs here.
I want to setup custom authentication flow for some applications, registered in Wso2 Api Manager. Say for some applications I want to direct them to federated IDP when they request access token using authorization code or implicit flow. As a key manager I use IdentityServer.
I know that in Identity server I can create Service provider and setup custom authentication scheme for it, e.g. using Federated Authentication. Unfortunetely this service provider can't act as a subscriber for apis in Api Manager. I found an article that describes how to override default auth scheme, but I don't what override defaults.
Is it possible to setup custom IDP only for specific applications and avoid tuning default authentication scheme for oauth flows. The reason here is that I still want to use attached userstores for most of the applications but override that behaviour only for some predefined applications.
WSO2 APIM 3.2.0 onward it supports multiple key managers support. With that, you can create an application binding to a specific key manager you register. You can register a KM from UI and by default, it supports multiple IDPs like okta,oauth0 and WSO2 IS.