Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Custom login portlet lipsa mishra November 21, 2011 1:01 AM
RE: Custom login portlet ugandhar @ November 21, 2011 2:48 AM
RE: Custom login portlet lipsa mishra November 21, 2011 3:43 AM
RE: Custom login portlet ugandhar @ November 21, 2011 4:12 AM
RE: Custom login portlet srikanth a November 21, 2011 4:26 AM
RE: Custom login portlet Paul Cheong February 21, 2012 7:27 PM
RE: Custom login portlet vijay k March 13, 2012 8:54 PM
RE: Custom login portlet tian ci March 19, 2012 12:01 AM
RE: Custom login portlet Srikanth Reddy Sanivarapu April 3, 2012 5:55 AM
RE: Custom login portlet vijay k April 18, 2012 11:40 PM
RE: Custom login portlet Jasar Muhiyudheen April 30, 2012 6:30 AM
RE: Custom login portlet vijay k May 1, 2012 1:52 PM
RE: Custom login portlet Jasar Muhiyudheen May 1, 2012 8:59 PM
RE: Custom login portlet Bart Simpson July 10, 2012 12:17 AM
RE: Custom login portlet Bart Simpson September 18, 2012 4:43 AM
RE: Custom login portlet Mazhar Alam September 18, 2012 5:18 AM
RE: Custom login portlet Jasar Muhiyudheen January 8, 2013 3:05 AM
RE: Custom login portlet Bart Simpson January 8, 2013 6:55 AM
RE: Custom login portlet Ken Driscoll July 2, 2012 1:27 PM
RE: Custom login portlet Phap Phan July 9, 2012 7:25 PM
RE: Custom login portlet Robert Seedorff August 31, 2012 12:37 AM
RE: Custom login portlet David Pereira September 20, 2012 12:37 PM
RE: Custom login portlet Ime Prezime March 8, 2013 3:20 AM
RE: Custom login portlet Neil Griffin March 8, 2013 7:13 AM
RE: Custom login portlet Ime Prezime March 11, 2013 3:10 AM
RE: Custom login portlet Vernon Singleton March 11, 2013 9:01 AM
RE: Custom login portlet Ime Prezime March 12, 2013 7:00 AM
RE: Custom login portlet Kumar M March 14, 2013 11:35 PM
RE: Custom login portlet Vernon Singleton March 15, 2013 6:51 AM
RE: Custom login portlet Kumar M March 15, 2013 7:17 AM
Re: [Liferay Forums][3. Development] RE: Custom login portlet Vernon Singleton March 18, 2013 10:44 AM
RE: Custom login portlet Nilesh Gundecha April 16, 2013 2:21 AM
RE: Custom login portlet Nilesh Gundecha April 16, 2013 2:34 AM
RE: Custom login portlet Christophe Cariou September 11, 2013 1:45 AM
RE: Custom login portlet Abdulbasit Shaikh May 21, 2014 4:33 AM
lipsa mishra
Custom login portlet
November 21, 2011 1:01 AM
Answer

lipsa mishra

Rank: New Member

Posts: 14

Join Date: July 15, 2011

Recent Posts

Hi all,

I want to use my own custom login portlet. by cliking on signin link &
i am redirected to my custom login portlet by using below lines in portal-ext.properties

auth.login.url=/web/guest/login

auth.login.portlet.name=Atyaf-Login

my custom portlet is having one Email-id field and one password field.

Now the problem is that when i am logging with test@liferay.com its not logging in.

Will anyone plz help me how to login a user through my own custom portlet.
ugandhar @
RE: Custom login portlet
November 21, 2011 2:48 AM
Answer

ugandhar @

Rank: Junior Member

Posts: 25

Join Date: November 21, 2011

Recent Posts

Hi Lipsa

Once you forward to the custom login portlet then you need to call liferay API in your custom login portlet ProcessAction() method and redirect to the home page which you have created.

in Liferay4.x we are using below API to call the liferay loginService.

LoginAction.login(httpReq, httpRes, UserId, Password, false);

But in Liferay6.x i feel they have change the liferay API like below.

LoginUtil.login(HttpServletRequest request, HttpServletResponse response, String login, password, boolean rememberMe, String authType)-- which gives an option to send login value as emailId by specifying authType="emailAddress".


Once you authenticated with any of the above liferay API method you can redirect to your home page.

NOTE: depends on your Liferay version you need to find the Liferay Login API params.
lipsa mishra
RE: Custom login portlet
November 21, 2011 3:43 AM
Answer

lipsa mishra

Rank: New Member

Posts: 14

Join Date: July 15, 2011

Recent Posts

Hi Ugandhar ,

Thanks for your valuable feedback
We have created a portlet. In that portlet we are not able to access the LoginUtil which I suppose is in portal-impl.jar.
And I think we cannot access the classes of portal-impl.jar directly.
Is there any other way to make the user login in the portal.


Thanks

lipsa
ugandhar @
RE: Custom login portlet
November 21, 2011 4:12 AM
Answer

ugandhar @

Rank: Junior Member

Posts: 25

Join Date: November 21, 2011

Recent Posts

Hi lipsa

we are using Ext environment so portal-impl.jar will be present and we imported the class directly and used it.
i think if we are using plugin environment then you can copy portal-impl.jar to your lib.

in Liferay6 we can use Hooks, as of now i am not having more idea on this.
srikanth a
RE: Custom login portlet
November 21, 2011 4:26 AM
Answer

srikanth a

Rank: Regular Member

Posts: 142

Join Date: February 20, 2011

Recent Posts

Hi Lipsa,
Try using the UserLocalServiceUtil class to authenticate the user and then forward to the required jsp.


regards
Sri
Paul Cheong
RE: Custom login portlet
February 21, 2012 7:27 PM
Answer

Paul Cheong

Rank: New Member

Posts: 7

Join Date: August 2, 2005

Recent Posts

I have the same issue.

I have tried to use UserLocalServiceUtil class to do the authentication, the authentication is success but when I forward to home page, liferay seems cannot regconize the user is logged in. Any paramenter should be set to session to let liferay know that the user is logged in?
vijay k
RE: Custom login portlet
March 13, 2012 8:54 PM
Answer

vijay k

Rank: New Member

Posts: 4

Join Date: March 5, 2012

Recent Posts

I was writing my own custom portlet for login process and I thought that as long as I call LoginUtil.login (from portal-impl.jar.) it will log me in. Then I realized that you can't have custom portlets using portal-impl.jar.

I think you can do it the ext plugin way, which I haven't tried.

But the following worked for me.

You can still use the service/method calls in portal-impl.jar from your custom portlets using PortalClassInvoker (from portal-service.jar located in tomcat/lib/ext), as follows (Thanks to Gordon Augat for telling me about this)
1MethodKey key = new MethodKey("com.liferay.portlet.login.util.LoginUtil", "login", HttpServletRequest.class, HttpServletResponse.class, String.class, String.class, boolean.class, String.class);
2PortalClassInvoker.invoke(false, key, new Object[] { PortalUtil.getHttpServletRequest(portletRequest), PortalUtil.getHttpServletResponse(portletResponse), username, password false, null});

after this redirect to,
1
2ThemeDisplay().getPathMain()


I don't want to go into details but, there is some classloader hierarchy/visibility magic happening here.

But, I had to do couple of more things to make it work.

1. set this in external portal properties file. I think it depends on what you are using to create custom portlets. I was using Vaadin and if I had this to true, the login process was invalidating the session, which was making my vaadin application freak out on me.
1
2session.enable.phishing.protection=false



Even after that my login didn't work. The LoginUtil.login method was being called correctly but I am still getting the login screen.

2.in liferay-portlet.xml, set the following. It took me couple of days to figure this out.
1
2 <private-session-attributes>false</private-session-attributes>

**NOTE: Liferay expects the <tags> in liferay-portlet.xml in certain order, otherwise it is barfing on me.

The Login process was like this, LoginUtil.login does its work and the com.liferay.portal.servlet.MainServlet.loginUser was making the login stick for the session by looking for some attributes ("j_remoteuser", "j_username" and few others) set by LoginUtil.login. The problem I had with my process was , when I call the LoginUtil.login method, it is setting lots of stuff in session object (gets from the request object I was sending) The session it was setting all of those was a PORTLETSESSION instance and MainServlet is looking into PORTALSESSION. So, I had to make sure that there is no private portlet session for my custom login portlet and have it use the portal session.

And that worked for me.


Hope that helps
tian ci
RE: Custom login portlet
March 19, 2012 12:01 AM
Answer

tian ci

Rank: New Member

Posts: 1

Join Date: March 18, 2012

Recent Posts

Hi Vijay,

I followed your method of implementation but I've encountered an exception stating "Invalid Authentication Token" after i send redirect to themeDisplay.gethPathMain(). On further troubleshooting from liferay src, it was thrown by the check() method in class com.liferay.portal.security.auth.SessionAuthToken. Apparently, the program is looking for a parameter "p_auth" from the request but it was not present.

vijay k:
I was writing my own custom portlet for login process and I thought that as long as I call LoginUtil.login (from portal-impl.jar.) it will log me in. Then I realized that you can't have custom portlets using portal-impl.jar.

I think you can do it the ext plugin way, which I haven't tried.

But the following worked for me.

You can still use the service/method calls in portal-impl.jar from your custom portlets using PortalClassInvoker (from portal-service.jar located in tomcat/lib/ext), as follows (Thanks to Gordon Augat for telling me about this)
1MethodKey key = new MethodKey("com.liferay.portlet.login.util.LoginUtil", "login", HttpServletRequest.class, HttpServletResponse.class, String.class, String.class, boolean.class, String.class);
2PortalClassInvoker.invoke(false, key, new Object[] { PortalUtil.getHttpServletRequest(portletRequest), PortalUtil.getHttpServletResponse(portletResponse), username, password false, null});

after this redirect to,
1
2ThemeDisplay().getPathMain()


I don't want to go into details but, there is some classloader hierarchy/visibility magic happening here.

But, I had to do couple of more things to make it work.

1. set this in external portal properties file. I think it depends on what you are using to create custom portlets. I was using Vaadin and if I had this to true, the login process was invalidating the session, which was making my vaadin application freak out on me.
1
2session.enable.phishing.protection=false



Even after that my login didn't work. The LoginUtil.login method was being called correctly but I am still getting the login screen.

2.in liferay-portlet.xml, set the following. It took me couple of days to figure this out.
1
2 <private-session-attributes>false</private-session-attributes>

**NOTE: Liferay expects the <tags> in liferay-portlet.xml in certain order, otherwise it is barfing on me.

The Login process was like this, LoginUtil.login does its work and the com.liferay.portal.servlet.MainServlet.loginUser was making the login stick for the session by looking for some attributes ("j_remoteuser", "j_username" and few others) set by LoginUtil.login. The problem I had with my process was , when I call the LoginUtil.login method, it is setting lots of stuff in session object (gets from the request object I was sending) The session it was setting all of those was a PORTLETSESSION instance and MainServlet is looking into PORTALSESSION. So, I had to make sure that there is no private portlet session for my custom login portlet and have it use the portal session.

And that worked for me.


Hope that helps
Srikanth Reddy Sanivarapu
RE: Custom login portlet
April 3, 2012 5:55 AM
Answer

Srikanth Reddy Sanivarapu

Rank: Regular Member

Posts: 191

Join Date: November 14, 2008

Recent Posts

Hi All,

I am getting the below exception after I deploy the code which they have given above.

java.lang.NoSuchMethodException: com.liferay.portlet.login.util.LoginUtil.login(com.liferay.portal.servlet.NamespaceServletRequest, com.liferay.portal.servlet.filters.strip.Stri
pResponse
, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.String)

Here is my code :
PortletRequest portletRequest = (PortletRequest)actionRequest;
PortletResponse portletResponse = (PortletResponse)actionResponse;

HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(portletRequest);
HttpServletResponse httpResponse = PortalUtil.getHttpServletResponse(portletResponse);

System.out.println("httpRequest--->" + httpRequest);
System.out.println("httpResponse--->" + httpResponse);

PortalClassInvoker.invoke("com.liferay.portlet.login.util.LoginUtil", "login",
new Object[] { httpRequest, httpResponse, "test@liferay.com", "test", false, CompanyConstants.AUTH_TYPE_EA});


Can any one help me with the correct way of getting HttpServletRequest Object and HettpServletResponse Object from actionReqeust and actionResponse objects in my processAction method.

Any help is really appreciated. Thanks in advance.

Regards,
Srik
vijay k
RE: Custom login portlet
April 18, 2012 11:40 PM
Answer

vijay k

Rank: New Member

Posts: 4

Join Date: March 5, 2012

Recent Posts

It all depends on which liferay version you are using. I am using 6.1 GA1.

My approach involved looking into the Liferay's core login process

which involves
1. calling a struts action mapped to "com.liferay.portal.action.LoginAction", which inturn makes a call to
2. LoginUtil.login(request, response, login, password, rememberMe, authType);

So, my idea was to duplicate the process by calling (LoginUtil.login(request, response, login, password, rememberMe, authType)). Hence, the following code.
1
2MethodKey key = new MethodKey("com.liferay.portlet.login.util.LoginUtil", "login", HttpServletRequest.class, HttpServletResponse.class, String.class, String.class, boolean.class, String.class);
3PortalClassInvoker.invoke(false, key, new Object[] { PortalUtil.getHttpServletRequest(portletRequest), PortalUtil.getHttpServletResponse(portletResponse), username, password false, null});
.

So, based on the problem (java.lang.NoSuchMethodException) you are having, I am thinking that you have a different version of liferay and it probably is not doing the same thing for the core login process. If that is the case, look into the core login struts action (most likely the same class "LoginAction") and see what it is doing.
Jasar Muhiyudheen
RE: Custom login portlet
April 30, 2012 6:30 AM
Answer

Jasar Muhiyudheen

Rank: New Member

Posts: 3

Join Date: April 30, 2012

Recent Posts

Hi,

I got the same issue and I am following the same way you mentiooned.

---------------------------------------------------------------
I have an index.jsp page where I have the following code.

MethodKey key = new
MethodKey("com.liferay.portlet.login.util.LoginUtil", "login",
HttpServletRequest.class, HttpServletResponse.class,
String.class, String.class, boolean.class, String.class);

PortalClassInvoker.invoke(false, key, new Object[] { request,
response, "monet", "m", true, "screenName"});

response.sendRedirect("http://localhost:9090/group/guest/home");
-----------------------------------------------------------------

In /liferay_portal_6.1/portlet-ext.properties I set 'session.enable.phishing.protection=false'

Since index.jsp is a normal jsp page, I cannot set '<private-session-attributes>false</private-session-attributes>' in liferay-portal.xml.

But still when I try to redirect to 'http://localhost:9090/group/guest/home', It goes to the login screen. I was getting some authentication exception which I solved. Now I think the user is getting autheticated but it redirects to the login screen again.

Please help me on this.

Thanks,
Jasar
vijay k
RE: Custom login portlet
May 1, 2012 1:52 PM
Answer

vijay k

Rank: New Member

Posts: 4

Join Date: March 5, 2012

Recent Posts

I don't understand what you meant by "............index.jsp is a normal jsp page, I cannot set <private-session-attributes>false</private-session-attributes>...............".

The setting is at the portlet level. Whether it is a jsp or some java code in an action/web-layer class that is doing the custom login process, it is part of your custom portlet. And that portlet should not have a private session (it has to use the same session as the portal), which is exactly what the setting "<private-session-attributes>" does. If your portlet has a private session, Liferay's MainServlet won't find the information it requires to log the user in, because it looks in the PORTAL SESSION and the login process that you called from your code, sets the information in the PORTLET SESSION that it gets from the request object you are passing in. In my case I have a Custom Login portlet with one UI component(I am using Vaadin instead of JSP in your case) and all it does is, shows the login page, do the custom login process and redirect to some place.
Jasar Muhiyudheen
RE: Custom login portlet
May 1, 2012 8:59 PM
Answer

Jasar Muhiyudheen

Rank: New Member

Posts: 3

Join Date: April 30, 2012

Recent Posts

In my war file there is no portlet. My war file contains only index.jsp. From that index.jsp I am calling LoginUtil.login method and redirects to 'http://localhost:9090/group/guest/home'. So I am not sure where to set <private-session-attributes>false</private-session-attributes>, since my liferay-portal.xml doesn't contain a <portlet> tag.
Ken Driscoll
RE: Custom login portlet
July 2, 2012 1:27 PM
Answer

Ken Driscoll

Rank: Junior Member

Posts: 57

Join Date: July 2, 2012

Recent Posts

Hello, I have followed this but am still having issues. I am using Liferay 6.1 GA1 and I am receiving no errors when it runs. However, it simply isn't logging me in.

Here is what I have:
1
2MethodKey key = new MethodKey("com.liferay.portlet.login.util.LoginUtil", "login", HttpServletRequest.class, HttpServletResponse.class, String.class, String.class, boolean.class, String.class);
3PortalClassInvoker.invoke(false, key, new Object[] { PortalUtil.getHttpServletRequest(actionRequest), PortalUtil.getHttpServletResponse(actionResponse), "user@test.com", "password", false, CompanyConstants.AUTH_TYPE_EA});


Please let me know if anyone else has had the same issue, or for any other ideas on how to get this working!

Thank you in advance.

vijay k:
I was writing my own custom portlet for login process and I thought that as long as I call LoginUtil.login (from portal-impl.jar.) it will log me in. Then I realized that you can't have custom portlets using portal-impl.jar.

I think you can do it the ext plugin way, which I haven't tried.

But the following worked for me.

You can still use the service/method calls in portal-impl.jar from your custom portlets using PortalClassInvoker (from portal-service.jar located in tomcat/lib/ext), as follows (Thanks to Gordon Augat for telling me about this)
1MethodKey key = new MethodKey("com.liferay.portlet.login.util.LoginUtil", "login", HttpServletRequest.class, HttpServletResponse.class, String.class, String.class, boolean.class, String.class);
2PortalClassInvoker.invoke(false, key, new Object[] { PortalUtil.getHttpServletRequest(portletRequest), PortalUtil.getHttpServletResponse(portletResponse), username, password false, null});

after this redirect to,
1
2ThemeDisplay().getPathMain()


I don't want to go into details but, there is some classloader hierarchy/visibility magic happening here.

But, I had to do couple of more things to make it work.

1. set this in external portal properties file. I think it depends on what you are using to create custom portlets. I was using Vaadin and if I had this to true, the login process was invalidating the session, which was making my vaadin application freak out on me.
1
2session.enable.phishing.protection=false



Even after that my login didn't work. The LoginUtil.login method was being called correctly but I am still getting the login screen.

2.in liferay-portlet.xml, set the following. It took me couple of days to figure this out.
1
2 <private-session-attributes>false</private-session-attributes>

**NOTE: Liferay expects the <tags> in liferay-portlet.xml in certain order, otherwise it is barfing on me.

The Login process was like this, LoginUtil.login does its work and the com.liferay.portal.servlet.MainServlet.loginUser was making the login stick for the session by looking for some attributes ("j_remoteuser", "j_username" and few others) set by LoginUtil.login. The problem I had with my process was , when I call the LoginUtil.login method, it is setting lots of stuff in session object (gets from the request object I was sending) The session it was setting all of those was a PORTLETSESSION instance and MainServlet is looking into PORTALSESSION. So, I had to make sure that there is no private portlet session for my custom login portlet and have it use the portal session.

And that worked for me.


Hope that helps
Phap Phan
RE: Custom login portlet
July 9, 2012 7:25 PM
Answer

Phap Phan

Rank: New Member

Posts: 5

Join Date: March 26, 2012

Recent Posts

I'm having the exact problem.

I'm currently running on Liferay 6.1.0 CE GA1 and want to create a custom login portlet. I followed your instructions but after click the button to log in, Liferay just doesn't let the user go through.
Bart Simpson
RE: Custom login portlet
July 10, 2012 12:17 AM
Answer

Bart Simpson

Rank: Liferay Master

Posts: 523

Join Date: August 29, 2011

Recent Posts

For authentication token , checkout the properties under
##
## Authentication Token
##

#
# Set this to true to enable authentication token security checks. The
# checks can be disabled for specific actions via the property
# "auth.token.ignore.actions" or for specific portlets via the init
# parameter "check-auth-token" in portlet.xml.
#
in portal.properties and you can make changes accordingly in portal-ext or even better in portlet.xml of your custom portlet

am gonna try this implementation and see how it works. Looks interesting. Till now I have used the autologin hooks for such situations.
Robert Seedorff
RE: Custom login portlet
August 31, 2012 12:37 AM
Answer

Robert Seedorff

Rank: New Member

Posts: 3

Join Date: December 16, 2010

Recent Posts

thx for your post, helped me alot!
Bart Simpson
RE: Custom login portlet
September 18, 2012 4:43 AM
Answer

Bart Simpson

Rank: Liferay Master

Posts: 523

Join Date: August 29, 2011

Recent Posts

I finally got some time to try it out with Liferay 6.1 GA2
The only change except for other things discussed in this thread is that another property is to be added to portal-ext.properties
1session.enable.phishing.protection=false

without this I was getting NPE when implementation tries to add session messages.
Mazhar Alam
RE: Custom login portlet
September 18, 2012 5:18 AM
Answer

Mazhar Alam

Rank: Regular Member

Posts: 188

Join Date: November 25, 2011

Recent Posts

helpful post...
David Pereira
RE: Custom login portlet
September 20, 2012 12:37 PM
Answer

David Pereira

Rank: New Member

Posts: 11

Join Date: May 23, 2012

Recent Posts

Muchas gracias, esto me ha ayudado mucho. Thanks!
Jasar Muhiyudheen
RE: Custom login portlet
January 8, 2013 3:05 AM
Answer

Jasar Muhiyudheen

Rank: New Member

Posts: 3

Join Date: April 30, 2012

Recent Posts

Still I am facing the same issue. No exception but user not getting in.

I have the settings in portal-ext.properties (session.enable.phishing.protection=false)
and in liferay-portlet.xml (<private-session-attributes>false</private-session-attributes> )

Even after that my login didn't work. The LoginUtil.login method was being called correctly but I am still getting the login screen.

my login code is inside portlet class.

try {
PortalClassInvoker.invoke(false, key, new Object[] { PortalUtil.getHttpServletRequest(request),
PortalUtil.getHttpServletResponse(response), "monet", "m", true, "screenName"});
response.sendRedirect("http://localhost:9090/group/guest/home");

} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

I am using Liferay 6.1-ce-ga1


Please help me out

Thanks,
Jasar
Bart Simpson
RE: Custom login portlet
January 8, 2013 6:55 AM
Answer

Bart Simpson

Rank: Liferay Master

Posts: 523

Join Date: August 29, 2011

Recent Posts

It worked for me when I tried, but it was on Liferay EE. Can you check:-
1. Debug the method LoginUtil.login and check the flow
2. After the request completes, open http://localhost:9090/group/guest/home in another tab and check if you are logged in
Ime Prezime
RE: Custom login portlet
March 8, 2013 3:20 AM
Answer

Ime Prezime

Rank: New Member

Posts: 4

Join Date: March 7, 2013

Recent Posts

Doesn't work for me.

I'm using Liferay 6.1.1 CE GA2.
I have custom JSF-based portlet.

LoginUtil.login method is executed, but nothing happens after that.

Property session.enable.phishing.protection is false.
Tag <private-session-attributes> in liferay-portlet.xml is false.

Any hints?
Maybe I'm passing wrong HttpServletRequest and HttpServletResponse objects?

Relevant code:
 1ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
 2       
 3PortletRequest portletRequest =  (PortletRequest) externalContext.getRequest();
 4PortletResponse portletResponse =  (PortletResponse) externalContext.getResponse();
 5       
 6HttpServletRequest httpServletRequest = PortalUtil.getHttpServletRequest(portletRequest);
 7HttpServletResponse httpServletResponse = PortalUtil.getHttpServletResponse(portletResponse);
 8
 9String username = "test";
10String password = "test";
11boolean rememberMe =false;
12       
13MethodKey methodKey = new MethodKey(
14         "com.liferay.portlet.login.util.LoginUtil",
15         "login",
16         HttpServletRequest.class,
17         HttpServletResponse.class,
18         String.class,
19         String.class,
20         boolean.class,
21         String.class );
22       
23String authType = CompanyConstants.AUTH_TYPE_SN;
24       
25PortalClassInvoker.invoke(
26         false,
27         methodKey,
28         new Object[] {
29                 httpServletRequest,
30                 httpServletResponse,
31                 username,
32                 password,
33                 rememberMe,
34                 authType } );
Neil Griffin
RE: Custom login portlet
March 8, 2013 7:13 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1981

Join Date: July 26, 2005

Recent Posts

Does your customer JSF Login portlet work if private-session-attributes=true (the default) and with a new out-of-the-box installation of Liferay Portal where session.enable.phishing.protection=false (the default)?
Ime Prezime
RE: Custom login portlet
March 11, 2013 3:10 AM
Answer

Ime Prezime

Rank: New Member

Posts: 4

Join Date: March 7, 2013

Recent Posts

Thanks for advice.

I tried fresh Liferay + JBoss 6.1.1 bundle.
I used Liferay Maven archetype to create simple JSF portlet plugin with only one portlet.
Portlet has a simple xhtml and simple view-scoped JSF bean with action from my previous post.

The behaviour is always the same, no matter how I set:
<private-session-attributes> in liferay-portlet.xml, or
session.enable.phishing.protection in portal-setup-wizard.properties.
Yes, I also tried the default combination, as you suggested.

Behaviour:
- If I enter correct screenname and password, action passes without errors. But, portal doesn't behave the same as with Liferay's login portlet when login is successful. ThemeDisplay.isSignedIn() method always returns false.
- If I enter incorrect screenname or password, I get AuthException from LoginUtil.login() method, which is expected.

Is there any custom login demo WAR which I can try?
Vernon Singleton
RE: Custom login portlet
March 11, 2013 9:01 AM
Answer

Vernon Singleton

LIFERAY STAFF

Rank: Regular Member

Posts: 162

Join Date: January 14, 2013

Recent Posts

Ime Prezime:
Is there any custom login demo WAR which I can try?


We ran into a similar problem in our testing with an older version of mojarra (i think it was mojarra 2.1.3 ..)

You will find a fairly recent version of a login portlet war in this snapshot directory:
https://oss.sonatype.org/content/repositories/snapshots/com/liferay/faces/demos/jsf2-login-portlet/3.1.2-ga3-SNAPSHOT/

You will also need to follow Stan Silvert's instructions for upgrading jboss's global class path with a newer version of mojarra ...
for this war you might as well use mojarra version 2.1.20.
Here are Stan's instructions:
https://community.jboss.org/message/756572#756572

Hope that helps,
Vernon
Ime Prezime
RE: Custom login portlet
March 12, 2013 7:00 AM
Answer

Ime Prezime

Rank: New Member

Posts: 4

Join Date: March 7, 2013

Recent Posts

This JSF login portlet demo is great. I tried it, and it worked.

I used ideas from it's source code to modify my own login portlet, which worked too after I used the same way to get HttpServletRequest and HttpServletResponse objects.

Thank you!
Kumar M
RE: Custom login portlet
March 14, 2013 11:35 PM
Answer

Kumar M

Rank: New Member

Posts: 15

Join Date: September 12, 2012

Recent Posts

Hi All,

I am new to liferay portal, currently i am working on liferay 6.1 EE with JSF primefaces , the above discussion is regarding the custom login portlet , i would like know when we will for Custom login portlet , we have already login portlet is available in lifeay.

Thanks and Regards
Vijay
Vernon Singleton
RE: Custom login portlet
March 15, 2013 6:51 AM
Answer

Vernon Singleton

LIFERAY STAFF

Rank: Regular Member

Posts: 162

Join Date: January 14, 2013

Recent Posts

Kumar M:
I am new to liferay portal, currently i am working on liferay 6.1 EE with JSF primefaces , the above discussion is regarding the custom login portlet , i would like know when we will for Custom login portlet , we have already login portlet is available in lifeay.


Hi Vijay,

Are you using Liferay with Tomcat? Jboss? Or some other configuration?
You may not have a need for a custom login portlet, but if you do, let me know.

- Vernon
Kumar M
RE: Custom login portlet
March 15, 2013 7:17 AM
Answer

Kumar M

Rank: New Member

Posts: 15

Join Date: September 12, 2012

Recent Posts

Hi Vernon,

I am using Tomcat.
I am not customizing the login portlet i want to know when we will go for customizing the login portlet.(any extra features)

Thanks
Vijay
Vernon Singleton
Re: [Liferay Forums][3. Development] RE: Custom login portlet
March 18, 2013 10:44 AM
Answer

Vernon Singleton

LIFERAY STAFF

Rank: Regular Member

Posts: 162

Join Date: January 14, 2013

Recent Posts

Well, you will go for customizing when the need arises. Maybe you will
want to change the flow of the login process, maybe change the options for
a first time login, or whatever your company or organization needs.

- Vernon



On Fri, Mar 15, 2013 at 10:17 AM, Kumar M from liferay.com <
forums@liferay.com> wrote:

> Hi Vernon,
>
> I am using Tomcat.
> I am not customizing the login portlet i want to know when we will go for
> customizing the login portlet.(any extra features)
>
> Thanks
> Vijay
>
>
> To view the thread, follow the link below:
>
> http://www.liferay.com/community/forums/-/message_boards/view_message/22677817
> --
> Thanks, Liferay.com Forums <http://http://www.liferay.com>
Nilesh Gundecha
RE: Custom login portlet
April 16, 2013 2:21 AM
Answer

Nilesh Gundecha

Rank: Regular Member

Posts: 188

Join Date: November 30, 2009

Recent Posts

Hi Friends,

I have implemented the Custom Login portlet and did all the steps as mentioned by Vijay K. All works fine except one strange issue -

If I load the page having my custom portlet and don't do anything for sometime (say half an hour) and then try to login then it gives me Forbidden status. I am not able to make out whats the issue. Any inputs please?

Regards,
Nilesh
Attachment

Attachments: Forbidden.png (21.1k)
Nilesh Gundecha
RE: Custom login portlet
April 16, 2013 2:34 AM
Answer

Nilesh Gundecha

Rank: Regular Member

Posts: 188

Join Date: November 30, 2009

Recent Posts

Can this happen because Liferay Login portlet and my Custom Login portlet as co-existing on the same page? Will they generate different auth token and so the issue?
Christophe Cariou
RE: Custom login portlet
September 11, 2013 1:45 AM
Answer

Christophe Cariou

Rank: Junior Member

Posts: 41

Join Date: October 1, 2007

Recent Posts

Hi vijay,

I used your method and it's working fine. I'm in the same context as you (Liferay 6.1 GA2 + Vaadin), except I'm on Vaadin 7.

The login action is correctly done and I redirect the user after login on a private page. All is fine.

BUT :
- If I close my browser after being logged in, without login out, and reopen it on the custom login page, the Vaadin portlet doesn't display at all !
Any other Vaadin portlet on public pages don't display at all.
I haven't any exception... just blank portlet (bootstrap code is present in the page).

To retrieve the portlets I must call a c/portal/logout url.

So, have you tested this case (closing browser after login and reopening the custom login page) and did you encounter the same trouble ?
If so, how did you correct it? perhaps via somme Vaadin session invalidation ?

Your help wilp be great for me.

Christophe
Abdulbasit Shaikh
RE: Custom login portlet
May 21, 2014 4:33 AM
Answer

Abdulbasit Shaikh

Rank: New Member

Posts: 6

Join Date: May 16, 2013

Recent Posts

Hi vijay k,

Thank you very very much. I was trying since last 3 days. Finally it worked for me. Thank you so much. But the only problem now is I am not able to redirect it to my custom liferay page.

Thanks and Regards,
Abdulbasit F Shaikh.