logout api error - Rest Spring Security Plugin in Grails - rest

I have integrated REST Spring Security plugin in a Grails app. Login works fine, and returns the correct access token. I can call other actions with this Authentication Token in X-Auth-Token in header.
I'm using Grails 2.4.4, and spring-security-rest plugin 1.4.0 with JDK 1.6.
However, the logout isn't working and throws Exception:
org.springframework.dao.DataAccessResourceFailureException: Could not
obtain current Hibernate Session; nested exception is
org.hibernate.HibernateException: No Session found for current
thread at
org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.getSession(GrailsHibernateTemplate.java:210)
I have tried to upgrade to 1.4.1, 1.5.0 but they seem to be dependent on JDK 1.7 version.

It is a known issue: https://github.com/alvarosanchez/grails-spring-security-rest/issues/135
It was fixed in the 1.4.1 release. You will have to upgrade to that version.

Related

Swagger 1.3.7 and Jersey 2.15/2.16 issue: the request entity is in a format not supported by the requested resource

I have a REST API that was working with Jersey 2.6 and Swagger 1.3.7. I read that Jersey 2.9 fixes a warning that I was getting so I upgraded to the latest Jersey 2.16 but then Swagger stopped working. I went back and upgraded one version at a time until I saw that Swagger was working with 2.15 so I settled on that. Now, the PUT API fails with Swagger with the following error:
The server refused this request because the request entity is in a format not supported by the requested resource for the requested method
The API works using FireFox RESTClient and specifying "application/json".
I do have "jersey-media-json-jackson" as a dependency and call "Client client = ClientBuilder.newClient().register(JacksonFeature.class);" in the program.
I tried upgrading Swagger but that did not help.
Has Swagger been verified to work with Jersey 2.15/2.16?
I've recently managed to get swagger-core to work with Jersey 2.16 with a similar issue. Keep in mind they are using the latest version (1.5.X) and not 1.3.X but the same solution will apply.
The problem is most likely with version resolution, specifically, the one of jackson-databind. For some reason, even jersey-media-json-jackson 2.16 depends on an older version of jackson-databind, even though it works fine with the latest version. Without having more details, it would be difficult to suggest a full solution, but you can follow the dependency tree and see the conflicts there.
If you do require further assistance, I'd suggest either using our mailing list, or even better, the IRC channel where we could interact online and resolve it.

Grails Spring Security Facebook Plugin not Working

I am trying to use spring security facebook plugin in grails. Here is my configuaration
BuildConfig.groovy:
compile ":spring-security-core:2.0-RC2"
compile ":spring-security-facebook:0.15.2-CORE2"
Config.groovy:
grails.plugins.springsecurity.facebook.domain.classname='com.spring.grails.loginapp.domains.auth.FacebookUser'
grails.plugins.springsecurity.facebook.appId='711430758877160'
grails.plugins.springsecurity.facebook.secret= *****
grails.plugins.springsecurity.facebook.autoCreate.enabled=true
grails.plugins.springsecurity.facebook.autoCreate.roles=['ROLE_USER', 'ROLE_FACEBOOK']
I created domin using s2-init-facebook. I created Login with facebook in my GSP.
But When I try to click Login With Facebook, I got Invalid app id error.
Invalid App ID: Invalid
When I go to http://graph.facebook.com/645351175512630 to verify my App it seems to be correct.
I Followed documentation of grails spring security facebook plugin.
First of all, you have to put configuration into Config.groovy. BuildConfig is used for dependencies.
Second, as you're using Spring Security Core version 2.x, then correct config prefix is grails.plugin.springsecurity (not grails.plugins.springsecurity, without s)

WSO2 SAML SSO for different carbon versions

I'm trying to setup SAML based SSO for set of WSO2 products (all used by latest versions available for now):
WSO2 Identity Server 4.5.0
WSO2 Business Rules Server 2.0.0
WSO2 ESB 4.7.0
WSO2 Business Activiti Monitoring 2.4.0
WSO2 Application Server 5.2.0
SSO works fine for BAM and AS, but failed for other servers (BRS, ESB).
I'm getting on IS side exception like:
[Fatal Error] :1:1: Content is not allowed in prolog.
[2013-11-01 22:16:26,830] ERROR {org.wso2.carbon.identity.sso.saml.util.SAMLSSOUtil} - Error in constructing AuthRequest from the encoded String
org.xml.sax.SAXParseException: Content is not allowed in prolog.
nd
As I understand problem is: IS, AS and BAM all based on carbon 4.2.0 - and as result SSO working fine, but BRS and ESB latest versions based on older carbon (4.1.0 or 4.0.0) and there are compatibility problem in message encoding between different carbon versions.
Question - is it possible to fix somehow tools based on older carbon version to make it working with latest carbon 4.2.0 based IS 4.5.0?
Or, in general, how setup SAML SSO independently from each carbon (or even not carbon-based at all) service providers used?
Yes this is a know issue. Identity Server 4.5.0 can not be used to do SSO with older carbon versions. This is due that SAML2 SSO authenticator in older carbon version is not complaint with IS 4.5.0 IDP. Actually there is some bug in the older versions. However there are some fixes for that. They can be found in public jiras (not sure). ESB and BRS are going to release soon, before end of Nov, Therefore you can try with newer versions as they are also based on Carbon 4.2.0 platform,
I am getting exactly same issue with same configuration. #Asela as you mentioned, I can either go with ESB 4.8.0 (or) IS 4.1.0; but what kind of issues we'll have when we go for decentralized federated SAML2 IdP.
Is IS 4.1.0 is compatible with ESB 4.7.0, and is tested in decentralized federated SAML2 IdP? If so, we would downgrade our IS to 4.1.0.

java.lang.NoSuchMethodError: javax.persistence.EntityManager.getMetamodel()

How to fix this error using OpenXava 4.6 with Glassfish 2.2:
javax.servlet.ServletException: java.lang.NoSuchMethodError: javax.persistence.EntityManager.getMetamodel()Ljavax/persistence/metamodel/Metamodel
I got this error when trying to access my test module from the browser.
http://localhost:8080/testmod/xava/module.jsp?application=testmod&module=test
In my case, using openxava 4.6 with glassfishESBv22 gave me the error java.lang.NoSuchMethodError: javax.persistence.EntityManager.getMetamodel... so when i changed the server to default tomcat bundle with OX4.6, it worked fine. that means it was the glassfish server problem...finally i used the latest glassfish server v3.1.2 and it also worked fine. so problem solved...only changing the server to the latest one was the solution.
OpenXava 4.6 uses JPA2, while the application server you're using uses JPA1. If you need to work with an old application server you can configure the classloaders in order that use JPA engine included your OpenXava application.

using Jira REST Java Client API i get java.lang.NoSuchMethodError in eclipse, but not with ANT

Must be the way Eclipse is set up. Anyone have any ideas?
Exception in thread "main" java.lang.NoSuchMethodError: com.sun.jersey.client.apache.DefaultApacheHttpMethodExecutor.headerValueToString(Ljava/lang/Object;)Ljava/lang/String;
at com.sun.jersey.client.apache.DefaultApacheHttpMethodExecutor.writeOutBoundHeaders(DefaultApacheHttpMethodExecutor.java:271)
It looks like DefaultApacheHttpMethodExecutor.headerValueToString was removed from the Jersey library after its 1.7 release:
http://java.net/projects/jersey/lists/commits/archive/2011-06/message/12
Here are some options:
Replace your current version of Jersey and with an older version of Jersey:
Use a newer version of the JIRA REST client. I don't know if any newer versions support the change to the Jersey API.
Actually, the "headerValueToString" method is supported in jersey-client-1.5.jar. Some later versions don't support the method yet, such as jersey-client-1.15.jar.
I use "jersey-apache-client-1.8.jar" downloaded from "http://download.java.net/maven/2/com/sun/jersey/contribs/jersey-apache-client/1.8/" and it works well