Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Custom login portlet lipsa mishra 21 novembre 2011 1.01
RE: Custom login portlet ugandhar @ 21 novembre 2011 2.48
RE: Custom login portlet lipsa mishra 21 novembre 2011 3.43
RE: Custom login portlet ugandhar @ 21 novembre 2011 4.12
RE: Custom login portlet srikanth a 21 novembre 2011 4.26
RE: Custom login portlet Paul Cheong 21 febbraio 2012 19.27
RE: Custom login portlet vijay k 13 marzo 2012 20.54
RE: Custom login portlet tian ci 19 marzo 2012 0.01
RE: Custom login portlet Srikanth Reddy Sanivarapu 3 aprile 2012 5.55
RE: Custom login portlet vijay k 18 aprile 2012 23.40
RE: Custom login portlet Jasar Muhiyudheen 30 aprile 2012 6.30
RE: Custom login portlet vijay k 1 maggio 2012 13.52
RE: Custom login portlet Jasar Muhiyudheen 1 maggio 2012 20.59
RE: Custom login portlet Bart Simpson 10 luglio 2012 0.17
RE: Custom login portlet Bart Simpson 18 settembre 2012 4.43
RE: Custom login portlet Mazhar Alam 18 settembre 2012 5.18
RE: Custom login portlet Jasar Muhiyudheen 8 gennaio 2013 3.05
RE: Custom login portlet Bart Simpson 8 gennaio 2013 6.55
RE: Custom login portlet Ken Driscoll 2 luglio 2012 13.27
RE: Custom login portlet Phap Phan 9 luglio 2012 19.25
RE: Custom login portlet Robert Seedorff 31 agosto 2012 0.37
RE: Custom login portlet David Pereira 20 settembre 2012 12.37
RE: Custom login portlet Ime Prezime 8 marzo 2013 3.20
RE: Custom login portlet Neil Griffin 8 marzo 2013 7.13
RE: Custom login portlet Ime Prezime 11 marzo 2013 3.10
RE: Custom login portlet Vernon Singleton 11 marzo 2013 9.01
RE: Custom login portlet Ime Prezime 12 marzo 2013 7.00
RE: Custom login portlet Kumar M 14 marzo 2013 23.35
RE: Custom login portlet Vernon Singleton 15 marzo 2013 6.51
RE: Custom login portlet Kumar M 15 marzo 2013 7.17
Re: [Liferay Forums][3. Development] RE: Custom login portlet Vernon Singleton 18 marzo 2013 10.44
RE: Custom login portlet Nilesh Gundecha 16 aprile 2013 2.21
RE: Custom login portlet Nilesh Gundecha 16 aprile 2013 2.34
RE: Custom login portlet Christophe Cariou 11 settembre 2013 1.45
RE: Custom login portlet Abdulbasit Shaikh 21 maggio 2014 4.33
lipsa mishra
Custom login portlet
21 novembre 2011 1.01
Risposta

lipsa mishra

Punteggio: New Member

Messaggi: 14

Data di Iscrizione: 15 luglio 2011

Messaggi recenti

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
21 novembre 2011 2.48
Risposta

ugandhar @

Punteggio: Junior Member

Messaggi: 25

Data di Iscrizione: 21 novembre 2011

Messaggi recenti

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
21 novembre 2011 3.43
Risposta

lipsa mishra

Punteggio: New Member

Messaggi: 14

Data di Iscrizione: 15 luglio 2011

Messaggi recenti

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
21 novembre 2011 4.12
Risposta

ugandhar @

Punteggio: Junior Member

Messaggi: 25

Data di Iscrizione: 21 novembre 2011

Messaggi recenti

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
21 novembre 2011 4.26
Risposta

srikanth a

Punteggio: Regular Member

Messaggi: 142

Data di Iscrizione: 20 febbraio 2011

Messaggi recenti

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
21 febbraio 2012 19.27
Risposta

Paul Cheong

Punteggio: New Member

Messaggi: 7

Data di Iscrizione: 2 agosto 2005

Messaggi recenti

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
13 marzo 2012 20.54
Risposta

vijay k

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 5 marzo 2012

Messaggi recenti

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
19 marzo 2012 0.01
Risposta

tian ci

Punteggio: New Member

Messaggi: 1

Data di Iscrizione: 18 marzo 2012

Messaggi recenti

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
3 aprile 2012 5.55
Risposta

Srikanth Reddy Sanivarapu

Punteggio: Regular Member

Messaggi: 191

Data di Iscrizione: 14 novembre 2008

Messaggi recenti

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
18 aprile 2012 23.40
Risposta

vijay k

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 5 marzo 2012

Messaggi recenti

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
30 aprile 2012 6.30
Risposta

Jasar Muhiyudheen

Punteggio: New Member

Messaggi: 3

Data di Iscrizione: 30 aprile 2012

Messaggi recenti

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
1 maggio 2012 13.52
Risposta

vijay k

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 5 marzo 2012

Messaggi recenti

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
1 maggio 2012 20.59
Risposta

Jasar Muhiyudheen

Punteggio: New Member

Messaggi: 3

Data di Iscrizione: 30 aprile 2012

Messaggi recenti

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
2 luglio 2012 13.27
Risposta

Ken Driscoll

Punteggio: Junior Member

Messaggi: 57

Data di Iscrizione: 2 luglio 2012

Messaggi recenti

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
9 luglio 2012 19.25
Risposta

Phap Phan

Punteggio: New Member

Messaggi: 5

Data di Iscrizione: 26 marzo 2012

Messaggi recenti

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
10 luglio 2012 0.17
Risposta

Bart Simpson

Punteggio: Liferay Master

Messaggi: 523

Data di Iscrizione: 29 agosto 2011

Messaggi recenti

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
31 agosto 2012 0.37
Risposta

Robert Seedorff

Punteggio: New Member

Messaggi: 3

Data di Iscrizione: 16 dicembre 2010

Messaggi recenti

thx for your post, helped me alot!
Bart Simpson
RE: Custom login portlet
18 settembre 2012 4.43
Risposta

Bart Simpson

Punteggio: Liferay Master

Messaggi: 523

Data di Iscrizione: 29 agosto 2011

Messaggi recenti

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
18 settembre 2012 5.18
Risposta

Mazhar Alam

Punteggio: Regular Member

Messaggi: 188

Data di Iscrizione: 25 novembre 2011

Messaggi recenti

helpful post...
David Pereira
RE: Custom login portlet
20 settembre 2012 12.37
Risposta

David Pereira

Punteggio: New Member

Messaggi: 11

Data di Iscrizione: 23 maggio 2012

Messaggi recenti

Muchas gracias, esto me ha ayudado mucho. Thanks!
Jasar Muhiyudheen
RE: Custom login portlet
8 gennaio 2013 3.05
Risposta

Jasar Muhiyudheen

Punteggio: New Member

Messaggi: 3

Data di Iscrizione: 30 aprile 2012

Messaggi recenti

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
8 gennaio 2013 6.55
Risposta

Bart Simpson

Punteggio: Liferay Master

Messaggi: 523

Data di Iscrizione: 29 agosto 2011

Messaggi recenti

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
8 marzo 2013 3.20
Risposta

Ime Prezime

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 7 marzo 2013

Messaggi recenti

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
8 marzo 2013 7.13
Risposta

Neil Griffin

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1981

Data di Iscrizione: 26 luglio 2005

Messaggi recenti

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
11 marzo 2013 3.10
Risposta

Ime Prezime

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 7 marzo 2013

Messaggi recenti

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
11 marzo 2013 9.01
Risposta

Vernon Singleton

LIFERAY STAFF

Punteggio: Regular Member

Messaggi: 162

Data di Iscrizione: 14 gennaio 2013

Messaggi recenti

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
12 marzo 2013 7.00
Risposta

Ime Prezime

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 7 marzo 2013

Messaggi recenti

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
14 marzo 2013 23.35
Risposta

Kumar M

Punteggio: New Member

Messaggi: 15

Data di Iscrizione: 12 settembre 2012

Messaggi recenti

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
15 marzo 2013 6.51
Risposta

Vernon Singleton

LIFERAY STAFF

Punteggio: Regular Member

Messaggi: 162

Data di Iscrizione: 14 gennaio 2013

Messaggi recenti

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
15 marzo 2013 7.17
Risposta

Kumar M

Punteggio: New Member

Messaggi: 15

Data di Iscrizione: 12 settembre 2012

Messaggi recenti

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
18 marzo 2013 10.44
Risposta

Vernon Singleton

LIFERAY STAFF

Punteggio: Regular Member

Messaggi: 162

Data di Iscrizione: 14 gennaio 2013

Messaggi recenti

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
16 aprile 2013 2.21
Risposta

Nilesh Gundecha

Punteggio: Regular Member

Messaggi: 188

Data di Iscrizione: 30 novembre 2009

Messaggi recenti

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
Allegato

Allegati: Forbidden.png (21,1k)
Nilesh Gundecha
RE: Custom login portlet
16 aprile 2013 2.34
Risposta

Nilesh Gundecha

Punteggio: Regular Member

Messaggi: 188

Data di Iscrizione: 30 novembre 2009

Messaggi recenti

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
11 settembre 2013 1.45
Risposta

Christophe Cariou

Punteggio: Junior Member

Messaggi: 41

Data di Iscrizione: 1 ottobre 2007

Messaggi recenti

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
21 maggio 2014 4.33
Risposta

Abdulbasit Shaikh

Punteggio: New Member

Messaggi: 6

Data di Iscrizione: 16 maggio 2013

Messaggi recenti

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.