더북(TheBook)

3. 이제 테스트해 보겠습니다. curl 명령어를 이용해 다음과 같이 실행합니다. 이때 -H 옵션은 헤더 값으로 Content-Type: application/json을 설정하고, -d 옵션 뒤에는 다음과 같이 JSON 형태의 데이터를 설정합니다. 마지막으로 토큰을 얻어 오는 URL을 입력하고 Enter를 누르면 토큰을 얻을 수 있습니다.

[root@controller ~]# curl -i </span>
   -H “Content-Type: application/json” </span>
   -d ‘
 { “auth”: {
     “identity”: {
       “methods”: [“password”],
       “password”: {
         “user”: {
           “name”: “admin”,
           “domain”: { “name”: “default” },
           “password”: “openstack”
         }
       }
     }
   }
 }’ </span>
   http://192.168.56.101:35357/v3/auth/tokens
HTTP/1.1 201 Created
Date: Sat, 23 Jul 2016 01:00:22 GMT
Server: Apache/2.4.6 (CentOS) modwsgi/3.4 Python/2.7.5
X-Subject-Token: gAAAAABXksGmUGbHo22NfVNHFWjXhZsCbyM4y3wNy8ZWVjspA4gMMgL0W93
ueAL6CreXVUjnNYtmhorF9N5_LLE6xgohpxab6g_iMGQKiJfCERA-CKjJAULXOiq61bloRC8-
CncPQxPVB2I8JgrICfqK6ji4dKjrA
Vary: X-Auth-Token
x-openstack-request-id: req-92378691-b071-42fe-80e2-382261057d77
Content-Length: 308
Content-Type: application/json

{“token”: {“issued_at”: “2016-07-23T01:00:22.000000Z”, “audit_ids”: [“sb34MnjMSGiIwjeA-dnqJQ”], “methods”: [“password”], “expires_at”: “2016-07-23T02:00:22.270700Z”, “user”: {“domain”: {“id”: “065f049d1bfa4806b18 4c263e1f9f3d5”, “name”: “default”}, “id”: “9289330807ac4310ac567f52b5f424d7”, “name”: “admin”}}}[root@controller ~]#

신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.