Background of curl:// :-
March-20-1998 to be curl's birthday. Curl is recursive acronym "Curl URL Request Library " and some times call backronym. You can refer more details regarding curl in this official site[1]. Further you can download everything-curl.pdf file in same site.[1] https://curl.haxx.se/
Prerequisite:-
java 1.7 or aboveWSO2 IS 5.2.0(still [December 7, 2016] latest version)
You can used curl command to different scenarios in WSO2 IS.
First example using curl for SCIM(System for Cross-domain Identity Management ) user creation in primary and secondary user store.
Primary User Store:-
curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Wickramasinghe","givenName":"Pradeepa"},"userName":'Pradeepa',"password":"qazwsx"}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users
Secondary User Store:-
curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Wickramasinghe","givenName":"Pradeepa"},"userName":'VIRTUSA.COM/Pradeepa',"password":"qazwsx"}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users
Further is it possible to create OAuth2 access token using curl://.
For this you need to create service provider using WSO2 IS management console. Refer WSO2 document for more details [2].[2] https://docs.wso2.com/display/IS520/Session+Management+with+Playground
According to the Oauth 2.0 specification available four grant types. Those are,
- Authorization Code
- Implicit
- Password(Resource Owner Password Credentials)
- Client Credentials
password:-
curl --user EFT1_0yv2HL84MYtH_wUtuh8Enga:x2QHCl9_OGzfGc0qZpSmSGfTp9Ua -k -d "grant_type=password&username=virtusa.com/Pradeepa&password=qazwsx&scope=openid" -H "Content-Type: application/x-www-form-urlencoded" https://localhost:9443/oauth2/token
client credentials:-
curl -u EFT1_0yv2HL84MYtH_wUtuh8Enga:x2QHCl9_OGzfGc0qZpSmSGfTp9Ua -k -d "grant_type=client_credentials" -H "Content-Type: application/x-www-form-urlencoded" https://localhost:9443/oauth2/token
Refresh token usage
sample curl command format,curl -k -d "grant_type=refresh_token&refresh_token=<refresh_token>" -H "Authorization: Basic <Base64Encoded(Client_Id:Client_Secret)>" -H "Content-Type: application/x-www-form-urlencoded" https://localhost:9443/oauth2/token
Access token Revoke
sample curl command format,curl -X POST --basic -u "<client id>:<client secret>" -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" -k -d "token=<token to revoke>&token_type_hint=access_token" https://localhost:9443/oauth2/revoke
No comments:
Post a Comment