How to get my first auth token?

248 views
Skip to first unread message

corneliu...@lsexperts.de

unread,
Oct 30, 2013, 8:28:16 AM10/30/13
to os...@googlegroups.com
Hello,

I want to take a look at osiam 0.10 to play with the scim interface.

I followed this howto to install the latest osiam tag.
https://github.com/osiam/server/wiki/detailed_reference_installation

    curl http://localhost:8080/osiam-resource-server/ServiceProviderConfigs

gives me a detailed json response so I think everything went fine.
As I an OAuth2 newbie I was wondering, what to do now. I understand that I need an access token to do a scim request.
Hm, to avoid the direct dive into the API, I though, ok, lets first see the API working and leave the understanding for the second step...

osiam=> select * from osiam_client;

 internal_id |       id       |         redirect_uri         | client_secret | accesstokenvalidityseconds | refreshtokenvalidityseconds | validityinseconds | implicit_approval | expiry
-------------+----------------+------------------------------+---------------+----------------------------+-----------------------------+-------------------+-------------------+--------
           3 | example-client | http://localhost:5000/oauth2 | secret        |                       2342 |                        2342 |              1337 | f          



I added an additional client:
           4 | example2       | http://osiam:5000/oauth2     | secret2       |                       2342 |                        2342 |              1337 | f                 | 2013-10-30 13:39:07

 id |       grants      
----+--------------------
  3 | authorization_code
  3 | refresh-token
  3 | password
  3 | client_credentials
  4 | authorization_code
  4 | refresh-token
  4 | password
  4 | client_credentials


osiam=> select * from osiam_client_scopes ;
 id | scope 
----+--------
  3 | GET
  3 | POST
  3 | PUT
  3 | PATCH
  3 | DELETE
  4 | GET
  4 | POST
  4 | PUT
  4 | PATCH
  4 | DELETE

Now I fetched the python connector, installed the python osiam module and changed the client id and the redirect and the auth url to my osiam server (no X) and fired up the client-server.py.
I started on the webpage http://osiam:5000 and I am redirected to the login for marissa/koala.

redirect uri is http://osiam:5000/oauth2
AuthZ-Server is http://osiam:8080/osiam-auth-server
INFO:werkzeug: * Running on http://0.0.0.0:5000/
INFO:werkzeug: * Restarting with reloader
redirect uri is http://osiam:5000/oauth2
AuthZ-Server is http://osiam:8080/osiam-auth-server
INFO:werkzeug:172.16.200.146 - - [30/Oct/2013 13:23:56] "GET / HTTP/1.1" 200 -
INFO:werkzeug:172.16.200.146 - - [30/Oct/2013 13:23:56] "GET /static/style.css HTTP/1.1" 200 -
INFO:werkzeug:172.16.200.146 - - [30/Oct/2013 13:24:00] "GET /redirect HTTP/1.1" 302 -
got auth code: lUYb8g
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): osiam
DEBUG:requests.packages.urllib3.connectionpool:"POST /osiam-auth-server/oauth/token?redirect_uri=http%3A%2F%2Fosiam%3A5000%2Foauth2&code=lUYb8g&grant_type=authorization_code HTTP/1.1" 401 None
response: {"error":"unauthorized","error_description":"Bad credentials"}
INFO:werkzeug:172.16.200.146 - - [30/Oct/2013 13:24:01] "GET /oauth2?code=lUYb8g&state=state HTTP/1.1" 302 -
INFO:werkzeug:172.16.200.146 - - [30/Oct/2013 13:24:01] "GET / HTTP/1.1" 200 -
INFO:werkzeug:172.16.200.146 - - [30/Oct/2013 13:24:02] "GET /static/style.css HTTP/1.1" 200 -

To my understanding the password is correct (I changed it in the table scim_user, but then I get another error msg).
So what credentials are bad here in my case?

Thanks a lot and kind regards
Cornelius
Message has been deleted

Thorsten Rossner

unread,
Oct 31, 2013, 8:35:16 AM10/31/13
to os...@googlegroups.com
Hi Cornelius,

I general you shouldn't modify the database directly.


Does this work for you (requesting the access token using the Client Credential Grant as shown in the example) and are you able to retrieve an access token with your setup this way? This would require the database to contain the initial OSIAM setup, you may want to run drop.sql and init.sql for that.

Thanks
Thorsten

corneliu...@lsexperts.de

unread,
Nov 1, 2013, 6:10:47 AM11/1/13
to os...@googlegroups.com
Hi Thorsten,

thanks for your response.

I dropped the database and run the init.sql anew.

The command
$ curl -H "Authorization: Basic ZXhhbXBsZS1jbGllbnQ6c2VjcmV0" -X POST -d "grant_type=client_credentials&scope=GET POST PUT DELETE" http://localhost:8080/osiam-auth-server/oauth/token
gives me a token successfully.

But running

curl -i -H "Accept:  application/json" -H "Content-type:  application/json" -H "Authorization: Bearer $YOUR_ACCESS_TOKEN" -X POST locesource-server/Client -d '{"id": "puckel", "accessTokenValiditySeconds": "9999", "refreshTokenValiditySeconds": "9999", "redirectUri": "http://puckel/something", "scope": ["POST", "PUT", "GET", "DELETE", "PATCH"], "validityInSeconds": "9999", "implicit": "false", "grants": ["authorization_code", "client_credentials", "refreshtoken"]}'

fails.

To keep things simple I though I could simply get the first example-client like this:

curl -i -H "Accept:  application/json" -H "Content-type:  application/json" -H "Authorization: Bearer $YOUR_ACCESS_TOKEN" -X POST localhost:8080/osiam-resource-server/Client/example-client

But this same java exception as before.

Kind regards
Cornelius

HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Transfer-Encoding: chunked
Date: Fri, 01 Nov 2013 10:08:50 GMT
Connection: close

<html><head><title>Apache Tomcat/7.0.28 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - org.codehaus.jackson.JsonParseException: Unexpected character ('&lt;' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@c22dc07; line: 1, column: 2]</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>org.codehaus.jackson.JsonParseException: Unexpected character ('&lt;' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@c22dc07; line: 1, column: 2]</u></p><p><b>description</b> <u>The server encountered an internal error (org.codehaus.jackson.JsonParseException: Unexpected character ('&lt;' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@c22dc07; line: 1, column: 2]) that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.RuntimeException: org.codehaus.jackson.JsonParseException: Unexpected character ('&lt;' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@c22dc07; line: 1, column: 2]
    org.osiam.security.authorization.AccessTokenValidationService.loadAuthentication(AccessTokenValidationService.java:49)
    org.osiam.security.authorization.AccessTokenValidationService$$FastClassByCGLIB$$5c9a4063.invoke(&lt;generated&gt;)
    org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
    org.osiam.resources.helper.MeasureDurationTimeOfMethods.wrapExceptionForSonar(MeasureDurationTimeOfMethods.java:60)
    org.osiam.resources.helper.MeasureDurationTimeOfMethods.measureTime(MeasureDurationTimeOfMethods.java:48)
    sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:606)
    org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
    org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
    org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
    org.osiam.security.authorization.AccessTokenValidationService$$EnhancerByCGLIB$$93e63bae.loadAuthentication(&lt;generated&gt;)
    org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationManager.authenticate(OAuth2AuthenticationManager.java:70)
    org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:108)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
    org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
</pre></p><p><b>root cause</b> <pre>org.codehaus.jackson.JsonParseException: Unexpected character ('&lt;' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@c22dc07; line: 1, column: 2]
    org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433)
    org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521)
    org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:442)
    org.codehaus.jackson.impl.ReaderBasedParser._handleUnexpectedValue(ReaderBasedParser.java:1198)
    org.codehaus.jackson.impl.ReaderBasedParser.nextToken(ReaderBasedParser.java:485)
    org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2770)
    org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2718)
    org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1863)
    org.osiam.security.authorization.AccessTokenValidationService.loadAuthentication(AccessTokenValidationService.java:47)
    org.osiam.security.authorization.AccessTokenValidationService$$FastClassByCGLIB$$5c9a4063.invoke(&lt;generated&gt;)
    org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
    org.osiam.resources.helper.MeasureDurationTimeOfMethods.wrapExceptionForSonar(MeasureDurationTimeOfMethods.java:60)
    org.osiam.resources.helper.MeasureDurationTimeOfMethods.measureTime(MeasureDurationTimeOfMethods.java:48)
    sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:606)
    org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
    org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
    org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
    org.osiam.security.authorization.AccessTokenValidationService$$EnhancerByCGLIB$$93e63bae.loadAuthentication(&lt;generated&gt;)
    org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationManager.authenticate(OAuth2AuthenticationManager.java:70)
    org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:108)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
    org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.28 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.2

Florian Wallner

unread,
Nov 1, 2013, 6:15:41 AM11/1/13
to os...@googlegroups.com
Hi Cornelius,
did You replace $YOUR_ACCESS_TOKEN with the access token you received? It's in the string   "Authorization: Bearer $YOUR_ACCESS_TOKEN"

Regards,
---Florian Wallner  


--
You received this message because you are subscribed to the Google Groups "OSIAM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osiam+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Bang! Bang!

corneliu...@lsexperts.de

unread,
Nov 1, 2013, 7:22:20 AM11/1/13
to os...@googlegroups.com
Hi Florian,

I set the enrionment variable

YOUR_ACCESS_TOKEN=xyz-....

Are there any additional information (tomcat logs) that might help?

Kind regards
Cornelius

Florian Wallner

unread,
Nov 1, 2013, 7:30:43 AM11/1/13
to corneliu...@lsexperts.de, os...@googlegroups.com
Hi Cornelius,

could you please provide us with exactly the lines you entered at the command line? I assume you exported the environment variable? 

Tomcat should log, at the usual place. Keep in mind that Osiam consists of two web applications, so you might have to check two log files, depending on your configuration.

Regards,
---Florian Wallner 

Cornelius Kölbel

unread,
Nov 1, 2013, 8:50:46 AM11/1/13
to Florian Wallner, os...@googlegroups.com
Hi Florain,

I am doing this.
Yes I forgot to export but nevertheless I obvously get the same error.

Kind regards
Cornelius

root@osiam:~/osiam0.10# curl -H "Authorization: Basic ZXhhbXBsZS1jbGllbnQ6c2VjcmV0" -X POST -d "grant_type=client_credentials&scope=GET POST PUT DELETE" http://localhost:8080/osiam-auth-server/oauth/token
{"access_token":"de6a8f7a-7f63-457c-ba01-36f30b192bcc","token_type":"bearer","expires_in":2342,"scope":"DELETE GET POST PUT"}root@osiam:~/osiam0.10#
root@osiam:~/osiam0.10#
root@osiam:~/osiam0.10#
root@osiam:~/osiam0.10# export YOUR_ACCESS_TOKEN=de6a8f7a-7f63-457c-ba01-36f30b192bcc

root@osiam:~/osiam0.10# curl -i -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer $YOUR_ACCESS_TOKEN" -X GET localhost:8080/osiam-resource-server/Client/example-client

HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Transfer-Encoding: chunked
Date: Fri, 01 Nov 2013 12:47:56 GMT

Connection: close

<html><head><title>Apache Tomcat/7.0.28 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - org.codehaus.jackson.JsonParseException: Unexpected character ('&lt;' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@2685e820; line: 1, column: 2]</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>org.codehaus.jackson.JsonParseException: Unexpected character ('&lt;' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@2685e820; line: 1, column: 2]</u></p><p><b>description</b> <u>The server encountered an internal error (org.codehaus.jackson.JsonParseException: Unexpected character ('&lt;' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@2685e820; line: 1, column: 2]) that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.RuntimeException: org.codehaus.jackson.JsonParseException: Unexpected character ('&lt;' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@2685e820; line: 1, column: 2]
 at [Source: java.io.StringReader@2685e820; line: 1, column: 2]
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.28 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.28</h3></body></html>root@osiam:~/osiam0.10#
signature.asc

Thorsten Roßner

unread,
Nov 1, 2013, 9:30:37 AM11/1/13
to os...@googlegroups.com
Hi Cornelius,

I assume you're facing a bug that was fixed in 0.10.1 - could you give it a try with that version?

http://maven-repo.evolvis.org/releases/org/osiam/osiam-auth-server/0.10.1/
http://maven-repo.evolvis.org/releases/org/osiam/osiam-resource-server/0.10.1/

Thanks
Thorsten

Thorsten Roßner

unread,
Nov 1, 2013, 9:32:30 AM11/1/13
to os...@googlegroups.com
Cornelius, please delete the directories where the TomCat unpacked the
war files into, otherwise the upgrade will not be applied.

Cornelius Kölbel

unread,
Nov 1, 2013, 9:51:06 AM11/1/13
to os...@googlegroups.com
Hello Thorsten,

I guess something is really strange here?
The directories are these of 0.10. Nevertheless I deleted them and
restartet tomcat.
Same issue.

Kind regards
Cornelius

root@osiam:~/osiam0.10# ls /var/lib/tomcat7/webapps/ -ltrh
insgesamt 27M
drwxr-xr-x 3 root root 4,0K Sep 17 10:33 ROOT
-rw-r--r-- 1 root root 10M Okt 21 10:16 osiam-auth-server.war
-rw-r--r-- 1 root root 17M Okt 21 10:17 osiam-resource-server.war
drwxr-xr-x 4 tomcat7 tomcat7 4,0K Okt 30 12:34 osiam-auth-server
drwxr-xr-x 4 tomcat7 tomcat7 4,0K Okt 30 12:35 osiam-resource-server
root@osiam:~/osiam0.10# ls /var/lib/tomcat7/webapps/ROOT/
index.html META-INF
root@osiam:~/osiam0.10# rm /var/lib/tomcat7/webapps/osiam-auth-server -r
root@osiam:~/osiam0.10# rm /var/lib/tomcat7/webapps/osiam-resource-server -r
root@osiam:~/osiam0.10# /etc/init.d/tomcat7 restart
[ ok ] Stopping Tomcat servlet engine: tomcat7.
[ ok ] Starting Tomcat servlet engine: tomcat7.
root@osiam:~/osiam0.10# curl -H "Authorization: Basic
ZXhhbXBsZS1jbGllbnQ6c2VjcmV0" -X POST -d
"grant_type=client_credentials&scope=GET POST PUT DELETE"
http://localhost:8080/osiam-auth-server/oauth/token

{"access_token":"d303f148-a18b-4727-b390-776e6440eae6","token_type":"bearer","expires_in":2341,"scope":"DELETE
GET POST PUT"}root@osiam:~/osiam0.10#
root@osiam:~/osiam0.10# export
YOUR_ACCESS_TOKEN=d303f148-a18b-4727-b390-776e6440eae6
root@osiam:~/osiam0.10# curl -i -H "Accept: application/json" -H
"Content-type: application/json" -H "Authorization: Bearer
$YOUR_ACCESS_TOKEN" -X GET
localhost:8080/osiam-resource-server/Client/example-client
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Transfer-Encoding: chunked
Date: Fri, 01 Nov 2013 13:43:39 GMT
Connection: close

<html><head><title>Apache Tomcat/7.0.28 - Error
report</title><style><!--H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
BODY
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
{color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
</head><body><h1>HTTP Status 500 -
org.codehaus.jackson.JsonParseException: Unexpected character ('&lt;'
(code 60)): expected a valid value (number, String, array, object,
'true', 'false' or 'null')
at [Source: java.io.StringReader@49676fdf; line: 1, column: 2]</h1><HR
size="1" noshade="noshade"><p><b>type</b> Exception
report</p><p><b>message</b> <u>org.codehaus.jackson.JsonParseException:
Unexpected character ('&lt;' (code 60)): expected a valid value (number,
String, array, object, 'true', 'false' or 'null')
at [Source: java.io.StringReader@49676fdf; line: 1, column:
2]</u></p><p><b>description</b> <u>The server encountered an internal
error (org.codehaus.jackson.JsonParseException: Unexpected character
('&lt;' (code 60)): expected a valid value (number, String, array,
object, 'true', 'false' or 'null')
at [Source: java.io.StringReader@49676fdf; line: 1, column: 2]) that
prevented it from fulfilling this request.</u></p><p><b>exception</b>
<pre>java.lang.RuntimeException:
org.codehaus.jackson.JsonParseException: Unexpected character ('&lt;'
(code 60)): expected a valid value (number, String, array, object,
'true', 'false' or 'null')
at [Source: java.io.StringReader@49676fdf; line: 1, column: 2]

org.osiam.security.authorization.AccessTokenValidationService.loadAuthentication(AccessTokenValidationService.java:49)

org.osiam.security.authorization.AccessTokenValidationService$$FastClassByCGLIB$$5c9a4063.invoke(&lt;generated&gt;)
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)

org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)

org.osiam.resources.helper.MeasureDurationTimeOfMethods.wrapExceptionForSonar(MeasureDurationTimeOfMethods.java:60)

org.osiam.resources.helper.MeasureDurationTimeOfMethods.measureTime(MeasureDurationTimeOfMethods.java:48)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)

org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)

org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)

org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)

org.osiam.security.authorization.AccessTokenValidationService$$EnhancerByCGLIB$$9dc7b2f0.loadAuthentication(&lt;generated&gt;)

org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationManager.authenticate(OAuth2AuthenticationManager.java:70)

org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:108)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
</pre></p><p><b>root cause</b>
<pre>org.codehaus.jackson.JsonParseException: Unexpected character
('&lt;' (code 60)): expected a valid value (number, String, array,
object, 'true', 'false' or 'null')
at [Source: java.io.StringReader@49676fdf; line: 1, column: 2]
org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433)

org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521)

org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:442)

org.codehaus.jackson.impl.ReaderBasedParser._handleUnexpectedValue(ReaderBasedParser.java:1198)

org.codehaus.jackson.impl.ReaderBasedParser.nextToken(ReaderBasedParser.java:485)

org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2770)

org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2718)
org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1863)

org.osiam.security.authorization.AccessTokenValidationService.loadAuthentication(AccessTokenValidationService.java:47)

org.osiam.security.authorization.AccessTokenValidationService$$FastClassByCGLIB$$5c9a4063.invoke(&lt;generated&gt;)
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)

org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)

org.osiam.resources.helper.MeasureDurationTimeOfMethods.wrapExceptionForSonar(MeasureDurationTimeOfMethods.java:60)

org.osiam.resources.helper.MeasureDurationTimeOfMethods.measureTime(MeasureDurationTimeOfMethods.java:48)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)

org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)

org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)

org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)

org.osiam.security.authorization.AccessTokenValidationService$$EnhancerByCGLIB$$9dc7b2f0.loadAuthentication(&lt;generated&gt;)

org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationManager.authenticate(OAuth2AuthenticationManager.java:70)

org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:108)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is
available in the Apache Tomcat/7.0.28 logs.</u></p><HR size="1"
noshade="noshade"><h3>Apache
Tomcat/7.0.28</h3></body></html>root@osiam:~/osiam0.10#


signature.asc

Cornelius Kölbel

unread,
Nov 1, 2013, 9:59:38 AM11/1/13
to os...@googlegroups.com
You made my day! ;-)

Indeed worked with 0.10.1.

I think I will continue another day.
Thanks a lot
Cornelius

root@osiam:/var/lib/tomcat7/webapps# ls
osiam-auth-server-0.10.1  osiam-auth-server-0.10.1.war    osiam-resource-server-0.10.1  osiam-resource-server-0.10.1.war    ROOT
root@osiam:/var/lib/tomcat7/webapps# ln -s osiam-auth-server-0.10.1 osiam-auth-server
root@osiam:/var/lib/tomcat7/webapps# ln -s osiam-resource-server-0.10.1 osiam-resource-server
root@osiam:/var/lib/tomcat7/webapps# /etc/init.d/tomcat7 restart

[ ok ] Stopping Tomcat servlet engine: tomcat7.
[ ok ] Starting Tomcat servlet engine: tomcat7.
root@osiam:/var/lib/tomcat7/webapps# curl -H "Authorization: Basic ZXhhbXBsZS1jbGllbnQ6c2VjcmV0" -X POST -d "grant_type=client_credentials&scope=GET POST PUT DELETE" http://localhost:8080/osiam-auth-server/oauth/token
{"access_token":"d9ecb0a7-6a90-4978-9158-9e80d1446349","token_type":"bearer","expires_in":2341,"scope":"DELETE GET POST PUT"}root@osiam:/var/lib/tomcat7/webapps#
root@osiam:/var/lib/tomcat7/webapps#
root@osiam:/var/lib/tomcat7/webapps#
root@osiam:/var/lib/tomcat7/webapps#
root@osiam:/var/lib/tomcat7/webapps# export YOUR_ACCESS_TOKEN=d9ecb0a7-6a90-4978-9158-9e80d1446349
root@osiam:/var/lib/tomcat7/webapps# curl -i -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer $YOUR_ACCESS_TOKEN" -X GET localhost:8080/osiam-resource-server/Client/example-client
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Fri, 01 Nov 2013 13:58:14 GMT

{"id":"example-client","accessTokenValiditySeconds":2342,"refreshTokenValiditySeconds":2342,"redirectUri":"http://localhost:5000/oauth2","scope":["POST","PATCH","GET","DELETE","PUT"],"grants":["refresh-token","client_credentials","authorization_code","password"],"implicit":false,"validityInSeconds":1337,"client_secret":"secret"}root@osiam:/var/lib/tomcat7/webapps#
You received this message because you are subscribed to a topic in the Google Groups "OSIAM" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/osiam/1KzTG9CyvdI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to osiam+un...@googlegroups.com.
signature.asc

Thorsten Rossner

unread,
Nov 4, 2013, 2:31:31 AM11/4/13
to os...@googlegroups.com
Hi Cornelius,

please let us know if now also the Python-Connector approach works or if you have any issues with that.

Cheers
Thorsten

Cornelius Kölbel

unread,
Nov 4, 2013, 5:56:17 AM11/4/13
to os...@googlegroups.com
Hello Thorsten,

Eureka!

I managed to create a new client, so that I can access my X-less Osiam
system from my workstation.
I created a new user from my workstation and made a user listing.

I will now take a look at the the python connector and try to do the
same in python using your python module.

Kind regards
Cornelius
signature.asc
Reply all
Reply to author
Forward
0 new messages