WSO2 Custom Grant Type with customized config properties

I've followed the doc https://docs.wso2.com/display/IS500/Writing+a+Custom+OAuth+2.0+Grant+Type

Now that I created my new Grant Type, I need do make it easy to config to each environment.

How can I add custom properties in a Custom Grant Type?

I need to use those properties to deploy the custom grant_type in distinct environments(production,QA, development, ...) without rebuilding the code.

For example, my Grant Type make a request to a REST Endpoint to validade the credentials, but this endpoint is different for each environment. (rigth now, my custimized grant type have those configuration properties hardcoded)

Upvotes: 0

Views: 181

Answers (1)

Velislava Kostadinova
Velislava Kostadinova

Reputation: 50

When you create a project with custom grant_type you can add as many query parameters as you want to your request.

Because of this you can add one custom parameter for your environment and base on this parameter you can add a logic in your custom grant type project to make a separate call to the different REST Endpoints.

In the documentation that you followed a such custom query parameter that I suggest to use is mobileNumber=0333444

EDIT:

Base on our communication I edit my first response.

You can use NetworkUtils.getLocalHostname() from org.wso2.carbon.utils jar library which will return HostName property from carbon.xml file.

Upvotes: 1

Related Questions