CloudFoundry UAA不接受HTTP Basic Auth

时间:2013-09-25 13:54:27

标签: cloudfoundry cloudfoundry-uaa

我在UAA(CloudFoundry v2)中创建了一个客户端:

$ uaac client add clienttest --scope testscope --secret mysecret --authorized_grant_types client_credentials
  scope: testscope
  client_id: clienttest
  authorized_grant_types: client_credentials
  id: clienttest

当我随后尝试为我的客户端获取令牌时(根据Dave Syer的例子),我将302重定向到登录表单:

$ curl "http://clienttest:mysecret@uaa.domain.com" -d grant_type=client_credentials -d client_id=clienttest -v
* About to connect() to uaa.domain.com port 80 (#0)
*   Trying 31.210.241.5...
* connected
* Connected to uaa.domain.com (31.210.241.5) port 80 (#0)
* Server auth using Basic with user 'clienttest'
> POST / HTTP/1.1
> Authorization: Basic ZGpvbmVzdGVzdDpteXNlY3JldA==
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8x zlib/1.2.5
> Host: uaa.domain.com
> Accept: */*
> Content-Length: 50
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 50 out of 50 bytes
< HTTP/1.1 302 Found
< Content-Length: 0
< Date: Wed, 25 Sep 2013 13:49:23 GMT
< Location: http://uaa.domain.com/login;jsessionid=D97804429EF745FBDF02F0F6DA278C66
< Server: Apache-Coyote/1.1
< Set-Cookie: JSESSIONID=D97804429EF745FBDF02F0F6DA278C66; Path=/; HttpOnly
< 
* Connection #0 to host uaa.domain.com left intact
* Closing connection #0

这是我的客户的状态:

$ uaac client get clienttest
  scope: testscope
  client_id: clienttest
  resource_ids: none
  authorized_grant_types: client_credentials
  authorities: uaa.none

我也在我们的admin用户身上尝试了此操作,我得到了相同的内容。

我可以使用uaac token client get clienttest成功获取令牌。

任何想法我做错了什么?

1 个答案:

答案 0 :(得分:0)

您没有指定要访问的特定网址,只是“/”,因此系统只会将您重定向到登录网址。

你指定 http://clienttest:mysecret@uaa.domain.com

但是你想做什么?