Saturday, February 20, 2016

A Lightweight Login API for WSO2 Carbon

1. Build the API from https://github.com/facilelogin/aratuwa/tree/master/carbon-security/org.wso2.carbon.security.login

2. Copy the artifact(login.war) created from the above step to IS_HOME/repository/deployment/server/webapps

3. Restart the WSO2 Identity Server and make sure the login.war is deployed properly.

4. Following is an example cURL request just to authenticate a user.

curl -k -v  -H "Content-Type: application/json"  -X POST -d @auth_req.json https://localhost:9443/login
auth_req.json:

{ 
   "username": "admin",
   "password": "admin"
}
Response:

HTTP/1.1 200 OK
{  
   "username":"admin",
   "user_claims":[  

   ],
   "roles":[  

   ]
}
5. Following is an example cURL request to authenticate a user and get all his roles.

curl -k -v  -H "Content-Type: application/json"  -X POST -d @auth_req.json https://localhost:9443/login
auth_req.json:

{  
   "username": "admin",
   "password": "admin",
   "with_roles": true
}
Response:

HTTP/1.1 200 OK
{  
   "username":"admin",
   "user_claims":[  

   ],
   "roles":[  
      "admin",
      "Application/oauth2-proxy",
      "Internal/everyone"
   ]
}
6. Following is an example cURL request to authenticate a user and get all his roles and a selected set of claims.

curl -k -v  -H "Content-Type: application/json"  -X POST -d @auth_req.json https://localhost:9443/login
auth_req.json:

{  
   "username": "admin",
   "password": "admin",
   "with_roles" : true,
   "claims" : ["http://wso2.org/claims/emailaddress"]
}
Response:

HTTP/1.1 200 OK
{  
   "username":"admin",
   "user_claims":[  
      {  
         "claim_uri":"http://wso2.org/claims/emailaddress",
         "value":[  
            "admin@wso2.com"
         ]
      }
   ],
   "roles":[  
      "admin",
      "Application/oauth2-proxy",
      "Internal/everyone"
   ]
}

1 comments:

Benny said...

I recently acquired hublot replica from you, I have not worn the watch yet because while I was adjusting the time the hands suddenly stopped moving. I have tried pushing the crown back in and trying it again but with no success. I absolutely love this rolex replica and don't want to part with it. I have had several watches from you now and had no replica watches with the others. Can you advise me what I should do next. For the Rolex Day Date watch. I have tried everything you told me to do with the watch, but it hasn't made any difference. The rolex replica hands are working but I can't adjust it to the correct time. Also the date has replica watches uk the same. It's stuck on 10. The Rolex Replica UK has good power to it and has been running now for 48 hours. I have tried and tried again to make it work so I can adjust it but the hands will not move. Can you advise me what I should do.