首页 > 代码库 > OpenStack IdentityService Keystone V3 API Curl实战

OpenStack IdentityService Keystone V3 API Curl实战

v3 API Examples Using Curl

<Tokens>

1,Default scope 获取token

Get an token with default scope (may be unscoped):

Tips CLI如下:

curl -i \
  -H "Content-Type: application/json" \
  -d ‘
{ "auth": {
    "identity": {
      "methods": ["password"],
      "password": {
        "user": {
          "name": "demo",
          "domain": { "id": "default" },
          "password": "321"
        }
      }
    }
  }
}‘ \
  http://5.10.124.181:5000/v3/auth/tokens ; echo

2,Project-scoped

Get a project-scoped token:

curl -i \
  -H "Content-Type: application/json" \
  -d ‘
{ "auth": {
    "identity": {
      "methods": ["password"],
      "password": {
        "user": {
          "name": "demo",
          "domain": { "id": "default" },
          "password": "321"
        }
      }
    },
    "scope": {
      "project": {
        "name": "demo_project",
        "domain": { "id": "default" }
      }
    }
  }
}‘ \
  http://5.10.124.181:5000/v3/auth/tokens ; echo

3,Domain-Scoped

Get a domain-scoped token (Note that you’re going to need a role-assignment on the domain first!):

curl -i \
  -H "Content-Type: application/json" \
  -d ‘
{ "auth": {
    "identity": {
      "methods": ["password"],
      "password": {
        "user": {
          "name": "admin",
          "domain": { "id": "default" },
          "password": "321"
        }
      }
    },
    "scope": {
      "domain": {
        "id": "default"
      }
    }
  }
}‘ \
  http://5.10.124.181:5000/v3/auth/tokens ; echo

4,Getting a token from a token

5,DELETE /v3/auth/tokens

Revoke a token:

<二,Domains>

Get /v3/domains

List domains:

 

OpenStack IdentityService Keystone V3 API Curl实战