Java Spring oauth2授权提供程序

Java Spring oauth2授权提供程序,java,spring-security,oauth-2.0,spring-security-oauth2,Java,Spring Security,Oauth 2.0,Spring Security Oauth2,我是Oauth新手,我有一个使用SpringOAuth2和xml的应用程序 配置参考 http://www.beingjavaguys.com/2014/10/spring-security-oauth2-integration.html 因此,下面获取令牌的URL是 http://localhost:8080/SpringRestSecurityOauth/oauth/token?grant_type=password&client_id=restapp&client_secr

我是Oauth新手,我有一个使用SpringOAuth2和xml的应用程序 配置参考
http://www.beingjavaguys.com/2014/10/spring-security-oauth2-integration.html

因此,下面获取令牌的URL是

http://localhost:8080/SpringRestSecurityOauth/oauth/token?grant_type=password&client_id=restapp&client_secret=restapp&username=beingjavaguys&password=spring@java
它给令牌重新应答。 因此,在请求url中,
客户机id
是在xml文件中硬编码的。我想在运行时发送clientId,grantType。
这里需要注意哪些事项。

通常,您会在标题中发送客户id/client\u secret

OAuth2只有在使用https时才是安全的,因为传输的是秘密数据

以下是一个示例(angularjs):

以下是《邮递员》杂志:

curl -X POST -H "Accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Basic 111111111111111" -H "Cache-Control: no-cache" -H "Postman-Token: 11111111-111111111111111" "https://localhost:8443/sf/api/oauth/token?grant_type=password&username=11111111111&password=**********"
curl -X POST -H "Accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Basic 111111111111111" -H "Cache-Control: no-cache" -H "Postman-Token: 11111111-111111111111111" "https://localhost:8443/sf/api/oauth/token?grant_type=password&username=11111111111&password=**********"