Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Mime Type "null": 'mimeType' must be not empty #80

Closed
langerc opened this issue Jun 24, 2014 · 5 comments
Closed

Invalid Mime Type "null": 'mimeType' must be not empty #80

langerc opened this issue Jun 24, 2014 · 5 comments

Comments

@langerc
Copy link

langerc commented Jun 24, 2014

after fixing issue #79 and updating to RC2

a new exception is raised. Again this exception is raised if i request a html or gsp page - no form, just a GET request in the browser.

org.springframework.http.InvalidMediaTypeException: Invalid mime type "null": 'mimeType' must not be empty
com.odobo.grails.plugin.springsecurity.rest.RestTokenValidationFilter.matchesBearerSpecPreconditions(RestTokenValidationFilter.groovy:143)
com.odobo.grails.plugin.springsecurity.rest.RestTokenValidationFilter.doFilter(RestTokenValidationFilter.groovy:63)
grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
com.odobo.grails.plugin.springsecurity.rest.RestAuthenticationFilter.doFilter(RestAuthenticationFilter.groovy:110)
grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:82)
com.odobo.grails.plugin.springsecurity.rest.RestLogoutFilter.doFilter(RestLogoutFilter.groovy:66)
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)

@alvarosanchez
Copy link
Member

Your problem is the same as #78. If you are upgrading from 1.3.x, please read http://alvarosanchez.github.io/grails-spring-security-rest/docs/guide/whatsNew14.html.

Essentially, you have to configure the filter chains accordingly (first item in what's new).

@MalteJ
Copy link

MalteJ commented Jun 24, 2014

I have the same problem with a newly created app. But I don't really get it.
I have set everything to the stateless chain

grails.plugin.springsecurity.filterChain.chainMap = [
'/**': 'JOINED_FILTERS,-exceptionTranslationFilter,-authenticationProcessingFilter,-securityContextPersistenceFilter']

but I always get the mimeType = null exception. I can get a Token and I can even logout. But I cannot access my controllers.

Best,
Malte

@MalteJ
Copy link

MalteJ commented Jun 24, 2014

It works if I use the header

Authorization: Bearer 1eqve12ikvncpp59ntiroiobkarv373h

If this header is missing I always get the mimeType 500 ERROR.
I would consider this as a bug!? Or am I doing something wrong?

@ertanden
Copy link

I do have the same problem on 1.4.0.RC3. I have my filterChain configured.

grails.plugin.springsecurity.filterChain.chainMap = [
'/api/': 'JOINED_FILTERS,-exceptionTranslationFilter,-authenticationProcessingFilter,-securityContextPersistenceFilter', // Stateless chain
'/
': 'JOINED_FILTERS,-restTokenValidationFilter,-restExceptionTranslationFilter' // Traditional chain
]

@alvarosanchez
Copy link
Member

This is going to be solved via #82. Meanwhile, the workaround is to disable bearer token support:

grails.plugin.springsecurity.rest.token.validation.useBearerToken = false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants