Layer7 API Management

API Gateway - set expiration and scope manually for Oauth token 

Aug 02, 2017 08:52 AM

Hello,

 

i came into a case when creating a new authenticated Oauth token was pain, as the process was involving many steps, and for developing policies it was kind of unfriendly.

 

So here is small hint for you how to make it easier for reenabling already expired token (and other case you imagine).

 

To make it most simple, you can do it directly from Policy Manager, just use assertion "Perform JDBC Query" and choose the Oauth connection.

 

Before we use query, lets define for you what is what:

- scope = scope the token has to have for policy to accept it

- expiration = !EPOCH TIMESTAMP!  when the token should expire (looks like unix timestamp, little shorter - use for example Epoch Converter - Unix Timestamp Converter  to create that

- token = token id

 

so below the example query:

 

update oauth_token set scope="what you need", expiration=1501706068 where token="xxxxxxxxxxxxx"

 

 

click on test, and when it shows "passed", you are all done.

 

You can then check in oauth manager to see the changes for the token.

 

hope this short guide find some usefulness for someone ;-)

Statistics
0 Favorited
2 Views
0 Files
0 Shares
0 Downloads

Related Entries and Links

No Related Resource entered.