stanaka
stanaka

Reputation: 397

WSO2 IS import OAuth service provider via code

I am attempting to import a service provider into my WSO2 Identity Server by using code. This tutorial seems to be saying that I to add my service provider xml configuration file to the WSO2_HOME/repository/identity/service-providers folder. However, it's a bit difficult to understand so I'm afraid I'm doing something wrong.

My requirements are:

  1. Set up OAuth service provider through code
  2. Include clientID, clientSecret, grant types, etc. in the .xml config files

My observations are as follows:

  1. If I put my service provider .xml file into the WSO2_HOME/repository/identity/service-providers folder before I have ever started my WSO2 server, the XML file is read and I can authenticate against it.
  2. If I put my service provider .xml file into the WSO2_HOME/repository/identity/service-providers folder on a subsequent WSO2 server startup the file is not read from the service-providers folder.
  3. I see the tutorial mention the file sso-idp-config.xml but I'm not sure where that comes into play. Do I need to utilize that file somehow?

I am confirming that service providers in observation 2 aren't being loaded into the server by both looking at the data in the H2 database (a row isn't written for the service provider in the SP_APP table) and attempting to authenticate against the service provider using a REST call

The tutorial I linked seems pretty comprehensive but it give directions for SAML authentication. Is there a resource/instructions I can use to do a code-first OAuth approach?

Upvotes: 0

Views: 168

Answers (1)

senthalan
senthalan

Reputation: 2416

From IS 5.7.0 supports import and export complete service provider configuration as the xml file. Here is the corresponding documentation. So I think you can use the respective admin service(ApplicationManagementService) to import the OAuth application from your code.

You can refer this doc to get the call the admin service.

Upvotes: 1

Related Questions