[AAA-157] Unable to create OAuth2 token for new user Created: 25/Jan/18  Updated: 23/Sep/19

Status: Open
Project: aaa
Component/s: None
Affects Version/s: Nitrogen-SR1
Fix Version/s: None

Type: Bug Priority: Medium
Reporter: Jan Srnicek Assignee: Venkatrangan Govindarajan
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
clones AAA-75 domain contains garbage characters wh... Confirmed

 Description   

While following tutorial on http://docs.opendaylight.org/en/latest/user-guide/authentication-and-authorization-services.html?highlight=aaa%7C#configuration-using-the-restful-web-service

I've run into some issues

Steps

1 . Create OAuth token for user admin

curl -X POST \
http://localhost:8181/oauth2/token \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=password&username=admin&password=admin&scope=sdn'

 

Response 201

{ "access_token": "*TOKEN*", "token_type": "Bearer", "expires_in": 3600 }

 

2. Create user domain

curl -X POST \
http://localhost:8181/auth/v1/domains \
-H 'Authorization: Bearer TOKEN' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '

{ "name":"XY", "description":"XY domain", "enabled":true }

'

Response 201

3.Create test user

curl -X POST \
http://localhost:8181/auth/v1/users \
-H 'Authorization: Basic YWRtaW46YWRtaW4=' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '

{ "name": "test_user", "password": "12345", "domainid": "XY", "description": "Test user account", "email": "test_user@xy.tech" }

'

Response 201

4. Create OAuth2 token for this user

curl -X POST \
http://localhost:8181/oauth2/token \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=password&username=test_user&password=12345&scope=xy'

Response 500

{"error_description":"The Claim is missing one or more of the required fields.","error":"java.lang.IllegalStateException"}

 



 Comments   
Comment by Ryan Goulding [ 08/Feb/18 ]

just change the content-type to application/json and should work.  It isn't right, but this code was not contributed by me.  I can take a look at a later time...

Generated at Wed Feb 07 19:08:47 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.