2016年5月10日火曜日

ClearPass: Oauth

ClearPass Oauth Request送信方法。

参考リンク
http://community.arubanetworks.com/t5/AAA-NAC-Guest-Access-BYOD/How-to-create-update-delete-ClearPass-Guest-Accounts-using-REST/ta-p/243745
http://community.arubanetworks.com/aruba/attachments/aruba/aaa-nac-guest-access-byod/20924/1/Using%20the%20ClearPass%20HTTP%20APIs.pdf

     -H "Content-Type: application/json" \
     -d $'{"grant_type": "password", "username": "qa", "password": "aruba123", "client_id": "meridian"}' \
     -m 30 \
     -v \
     -k
---------------
Aruba-no-MacBook-Air-2:~ aruba$ curl -X POST "https://clearpass.arubademo.net/api/oauth"      -H "Content-Type: application/json"      -d $'{"grant_type": "password", "username": "kurokawa@hpe.com", "password": "3590", "client_id": "meridian"}'      -m 30      -v      -k
*   Trying 104.36.251.158...
* Connected to clearpass.arubademo.net (104.36.251.158) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
* Server certificate: clearpass.arubademo.net
* Server certificate: Go Daddy Secure Certificate Authority - G2
* Server certificate: Go Daddy Root Certificate Authority - G2
> POST /api/oauth HTTP/1.1
> Host: clearpass.arubademo.net
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 103
* upload completely sent off: 103 out of 103 bytes
< HTTP/1.1 200 OK
< Date: Tue, 10 May 2016 04:39:37 GMT
< Server: Apache
< X-Powered-By: PHP/5.5.30
< Cache-Control: no-store
< Pragma: no-cache
< Content-Length: 173
< Content-Type: application/json
* Connection #0 to host clearpass.arubademo.net left intact

{"access_token":"c646a32bb703c907502280bbee513c2a6f0e6e2d","expires_in":604800,"token_type":"Bearer","scope":null,"refresh_token":"f1953e0ed08e1b8b926d635aaf9669e4e33d33b6"}
Aruba-no-MacBook-Air-2:~ aruba$ 

-----------------
ClearPass API: access_tokenからの逆引き

https://clearpass.arubademo.net/api-docs/OperatorLogins-v1#!/GetAccount

Authorization:Bearer 7f216595d41eb90157944a8e67e76b09c2736376

{
"visitor_name": "TK",
"info": "XXX@hpe.com",
"name": "TK",
"guest_email": "XXX@hpe.com",
"badge_id": "102865"
}


-----------------
ClearPass API: access_tokenからの逆引きでcurlを使った場合

curl -X GET "https://clearpass.arubademo.net:443/api/oauth/me" \
-H "Accept: application/json" \
-H "Authorization: Bearer 7f216595d41eb90157944a8e67e76b09c2736376" \
-m 30 \
-v \

-k

Aruba-no-MacBook-Air-2:~ aruba$ curl -X GET "https://clearpass.arubademo.net:443/api/oauth/me" \
> -H "Accept: application/json" \
> -H "Authorization: Bearer 7f216595d41eb90157944a8e67e76b09c2736376" \
> -m 30 \
> -v \
> -k
*   Trying 104.36.251.158...
* Connected to clearpass.arubademo.net (104.36.251.158) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
* Server certificate: clearpass.arubademo.net
* Server certificate: Go Daddy Secure Certificate Authority - G2
* Server certificate: Go Daddy Root Certificate Authority - G2
> GET /api/oauth/me HTTP/1.1
> Host: clearpass.arubademo.net
> User-Agent: curl/7.43.0
> Accept: application/json
> Authorization: Bearer 7f216595d41eb90157944a8e67e76b09c2736376
< HTTP/1.1 200 OK
< Date: Tue, 10 May 2016 04:45:58 GMT
< Server: Apache
< X-Powered-By: PHP/5.5.30
< Content-Length: 112
< Content-Type: application/json; charset=utf-8
* Connection #0 to host clearpass.arubademo.net left intact
{"visitor_name":"TK","info":"XXX@hpe.com","name":"TK","guest_email":"XXX@hpe.com","badge_id":"102865"}

0 件のコメント:

コメントを投稿