These are chat archives for alvarosanchez/spring-security-rest

8th
Jul 2015
Ejaz Ahmed
@ejaz-ahmed
Jul 08 2015 05:23
Thanks @ChaosWars for your response. I have tried this too. It results in exceptions as below
 curl -X GET -i -H "Authorization:Bearer pi86f2qboar5so0h10h0sjod56bl57re" -H "Accept: application/json"  http://localhost:8080/restful-grails-springsecurity-greach2014/categories
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Language: en
Content-Length: 4472
Date: Wed, 08 Jul 2015 05:22:01 GMT
Connection: close

<html><head><title>Apache Tomcat/7.0.52 - 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 - Timeout waiting for value</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>Timeout waiting for value</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>net.spy.memcached.OperationTimeoutException: Timeout waiting for value
    net.spy.memcached.MemcachedClient.getAndTouch(MemcachedClient.java:1179)
    net.spy.memcached.MemcachedClient.getAndTouch(MemcachedClient.java:1196)
    grails.plugin.springsecurity.rest.token.storage.MemcachedTokenStorageService.findExistingUserDetails(MemcachedTokenStorageService.groovy:64)
    grails.plugin.springsecurity.rest.token.storage.MemcachedTokenStorageService.loadUserByToken(MemcachedTokenStorageService.groovy:37)
    grails.plugin.springsecurity.rest.RestAuthenticationProvider.authenticate(RestAuthenticationProvider.groovy:55)
    grails.plugin.springsecurity.rest.RestTokenValidationFilter.doFilter(RestTokenValidationFilter.groovy:75)
    grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
    grails.plugin.springsecurity.rest.RestAuthenticationFilter.doFilter(RestAuthenticationFilter.groovy:139)
    grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:53)
    grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:62)
    grails.plugin.springsecurity.rest.RestLogoutFilter.doFilter(RestLogoutFilter.groovy:80)
    com.brandseye.cors.CorsFilter.doFilter(CorsFilter.java:82)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    java.lang.Thread.run(Thread.java:745)
</pre></p><p><b>root cause</b> <pre>net.spy.memcached.internal.CheckedOperationTimeoutException: Timed out waiting for operation - failing node: localhost/127.0.0.1:11211
    net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:167)
    net.spy.memcached.MemcachedClient.getAndTouch(MemcachedClient.java:1168)
    net.spy.memcached.MemcachedClient.getAndTouch(MemcachedClient.java:1196)
    grails.plugin.springsecurity.rest.token.storage.MemcachedTokenStorageService.findExistingUserDetails(MemcachedTokenStorageService.groovy:64)
    grails.plugin.springsecurity.rest.token.storage.MemcachedTokenStorageService.loadUserByToken(MemcachedTokenStorageService.groovy:37)
    grails.plugin.springsecurity.rest.RestAuthenticationProvider.authenticate(RestAuthenticationProvider.groovy:55)
    grails.plugin.springsecurity.rest.RestTokenValidationFilter.doFilter(RestTokenValidationFilter.groovy:75)
    grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
    grails.plugin.springsecurity.rest.RestAuthenticationFilter.doFilter(RestAuthenticationFilter.groovy:139)
    grails.plugin.springsecurity.web.
Ejaz Ahmed
@ejaz-ahmed
Jul 08 2015 06:25
From the this exception, it looked like memcached has some storage issues. I changed the token storage to grails cache but still facing the same exception
Lawrence Lee
@ChaosWars
Jul 08 2015 10:59
There should be a space between "Authorization:" and "Bearer", not sure if this matters
But yeah, memcached is having issues. I used memcached before a while back with this plugin, but it just worked
@alvarosanchez I have a question: I need to generate a token for admins for any user so that the admin can log in as that user to view their account in cases of bug reports. Is there a function I can call to generate a JWT on command for any user?
Ejaz Ahmed
@ejaz-ahmed
Jul 08 2015 11:04
@ChaosWars Adding space has no effect on response. I am still getting the same exception
I have not configured memcached by the way. From the exception message, I thought it is using it by default. I am using this repo without any modifications
Lawrence Lee
@ChaosWars
Jul 08 2015 11:41
Well obviously you have to make sure that memcached is running, but that's the only thing I remember having to do
Ejaz Ahmed
@ejaz-ahmed
Jul 08 2015 12:00
Thanks @ChaosWars. I have installed memcached and things are fine now. I was thinking memcached is something like grails cache and will not be an external app (I am new to webapps).
So I will have to make it work with grails cache somehow
Lawrence Lee
@ChaosWars
Jul 08 2015 12:07
:+1:
Ejaz Ahmed
@ejaz-ahmed
Jul 08 2015 12:18
:clap: