How to add OAuth2+JWT authentication to a Spring Lemon based application - spring-lemon

I was pondering what would be the best way to incorporate OAuth2+JWT authentication to a Spring Lemon based application. Precisely, would it be possible by extending the LemonSecurityConfig class, or the source of Spring Lemon needs any change?

Related

Login/Registration functionality in cq5

I need to create register/login functionality in CQ5. There are three ways
1 - The register/login functionality should be prepared as web service hosted on a Java Application Server and then we can consume data from web services.
2 - The functionality should be prepared as web service based on RESTFull that hosted on CQ itself since AEM is developed around the REST principal and REST web services is certainly one which will be supported. So I believe RESTfull web services can be hosted with CQ5.
3 - Why do we need web services? I do not think it requires web services since my application is not going to communicate with other application and it dont want to expose any services to outside world. Why don't we create register/login functionality as we do in normal web application. Can we create a OSGI bundle that invoke databases to store user details for register/login functionality?
I would go for 3rd option but my concern is AEM is not the place to build our business logic to carry out functions that are not related to content rendering.
which option would you choose and why? Kindly share your ideas and thoughts. I am just looking for best solution to develop register/login functionality in CQ.
Thanks
I think i am late to the party but it might help someone. Yes, you can very well create rest webservices in CQ and they work well. So, you can take that approach.
The way to go about implementing login/registration would be how it is done OOTB but OOTB is also bad in the way it implements it so you have to make modifications to overcome that.
1) You need to register and Authentication handler with CQ. If you are looking for a sample there is a form authentication handler source that you can look at.
2) We have integrated out Auth handler with Active Directory (AD). Since AD is supported by default, so it is easy to integrate with Auth Handlers.
3) Next you need to create a user login token for which you can look into TokenUtil class of CQ or if you are looking to develop SSO, you can look into SSO code that is packaged OOTB.

Hibernate RESTful webservices in NetBeans

Is it possible to create RESTful Web Service using Hibernate in Netbeans 7.4?
I could see wizard to create RESTful Web Service using Persistence, but would like to know how it can be integrated with Hibernate?
Appreciate any help or insight.
Edit 1
I would like to know what I did is the correct method of generating RESTful web services using Hibernate.
First I generated Hibernate Entity classes using NetBeans and then I created RESTful services from Entity classes. So does this creates RESTful Web Services with Hibernate? I could see AbstractFacade classes that is almost like DAO classes
Edit 2
Screen shot for selecting RESTful Web Service from Entity classes
If you want to build a truly RESTful service, you need to build up a link relation architecture. You're going to need more than Hibernate or Netbeans to do that.
I recommend using the milestone Spring Data REST in conjunction with Hibernate's JPA implementation and Spring HATEOAS. See Spring Restbucks as an example which brings all these technologies together.

Webservices for Spring 2.5.5

I have web application designed using spring 2.5.5 MVC, JBoss server. I want to expose my spring services (like add/update User, comments, documents, etc.) using WebService for EAI. Requirement is like any third-party application should be able to perform operations in my web application after authentication/authorization.
I have novice knowledge of SOAP (Axis2) and REST (Jersey), however i am not sure which will be best suited for my application.
Cheers
We are using Spring 3.0 actually. But former using Axis2 with Spring 2.5.x.
You might review our stack at http://incubator.apache.org/openmeetings the axis.
We simply integrated the regular Axis2 configuration into the web.xml and build a Facade to load the spring beans into the Axis enables Web-Service and forward the calls to the Spring enabled context that way.
Comparable to https://svn.apache.org/repos/asf/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/axis/services/FileWebServiceFacade.java
It is not the perfect solution, the Axis2 documentation also contains other ways to load the Spring context in the Web-Service enabled class, however it was never possible to make that work stable so we decided for this workaround.

spring web controller use as web service

Currently I use Spring mvc to develop my we application. In future there will be a requirement to develop mobile app for this application.
In asp.net c# MVC have ability to use there web controller class as the web service. Then mobile app can use that controller class as web service.
I want to know is there an ability to use Spring MVC controllers as a we service. If yes, then how. Please explain.
You can easily write a Restful webservice using Spring MVC. The controller classes can return XML/JSON as required. It is simply a case of configuring an appropriate ViewResolver in this case a ContentNegotiationViewResolver.
This is an excellent guide which will walk you through the basics of Spring MVC as a webservice.

EJB 3 | Entities with webservices

I want to access a inventory system which is accessible through webservice, What is the best way to integrate, I thought of directly expose the entity facade as a web service using #WebSerive it's possible but don't know whether it's a good approach or not, need some advice.
Thanks.
You could eventually define the methods to be exposed in the same class (or maybe create a wrapper).
My understanding is that you want to consume a web service i.e. to implement a web service client. My recommendation would be to use JAX-WS for this. See :
A Simple JAX-WS Client in the Java EE 5 Tutorial
Developing JAX-WS Web Service Clients