Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Custom login portlet lipsa mishra 21 de Novembro de 2011 01:01
RE: Custom login portlet ugandhar @ 21 de Novembro de 2011 02:48
RE: Custom login portlet lipsa mishra 21 de Novembro de 2011 03:43
RE: Custom login portlet ugandhar @ 21 de Novembro de 2011 04:12
RE: Custom login portlet srikanth a 21 de Novembro de 2011 04:26
RE: Custom login portlet Paul Cheong 21 de Fevereiro de 2012 19:27
RE: Custom login portlet vijay k 13 de Março de 2012 20:54
RE: Custom login portlet tian ci 19 de Março de 2012 00:01
RE: Custom login portlet Srikanth Reddy Sanivarapu 3 de Abril de 2012 05:55
RE: Custom login portlet vijay k 18 de Abril de 2012 23:40
RE: Custom login portlet Jasar Muhiyudheen 30 de Abril de 2012 06:30
RE: Custom login portlet vijay k 1 de Maio de 2012 13:52
RE: Custom login portlet Jasar Muhiyudheen 1 de Maio de 2012 20:59
RE: Custom login portlet Bart Simpson 10 de Julho de 2012 00:17
RE: Custom login portlet Bart Simpson 18 de Setembro de 2012 04:43
RE: Custom login portlet Mazhar Alam 18 de Setembro de 2012 05:18
RE: Custom login portlet Jasar Muhiyudheen 8 de Janeiro de 2013 03:05
RE: Custom login portlet Bart Simpson 8 de Janeiro de 2013 06:55
RE: Custom login portlet Ken Driscoll 2 de Julho de 2012 13:27
RE: Custom login portlet Phap Phan 9 de Julho de 2012 19:25
RE: Custom login portlet Robert Seedorff 31 de Agosto de 2012 00:37
RE: Custom login portlet David Pereira 20 de Setembro de 2012 12:37
RE: Custom login portlet Ime Prezime 8 de Março de 2013 03:20
RE: Custom login portlet Neil Griffin 8 de Março de 2013 07:13
RE: Custom login portlet Ime Prezime 11 de Março de 2013 03:10
RE: Custom login portlet Vernon Singleton 11 de Março de 2013 09:01
RE: Custom login portlet Ime Prezime 12 de Março de 2013 07:00
RE: Custom login portlet Kumar M 14 de Março de 2013 23:35
RE: Custom login portlet Vernon Singleton 15 de Março de 2013 06:51
RE: Custom login portlet Kumar M 15 de Março de 2013 07:17
Re: [Liferay Forums][3. Development] RE: Custom login portlet Vernon Singleton 18 de Março de 2013 10:44
RE: Custom login portlet Nilesh Gundecha 16 de Abril de 2013 02:21
RE: Custom login portlet Nilesh Gundecha 16 de Abril de 2013 02:34
RE: Custom login portlet Christophe Cariou 11 de Setembro de 2013 01:45
lipsa mishra
Custom login portlet
21 de Novembro de 2011 01:01
Resposta

lipsa mishra

Ranking: New Member

Mensagens: 14

Data de entrada: 15 de Julho de 2011

Mensagens recentes

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 de Novembro de 2011 02:48
Resposta

ugandhar @

Ranking: New Member

Mensagens: 24

Data de entrada: 21 de Novembro de 2011

Mensagens recentes

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 de Novembro de 2011 03:43
Resposta

lipsa mishra

Ranking: New Member

Mensagens: 14

Data de entrada: 15 de Julho de 2011

Mensagens recentes

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 de Novembro de 2011 04:12
Resposta

ugandhar @

Ranking: New Member

Mensagens: 24

Data de entrada: 21 de Novembro de 2011

Mensagens recentes

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 de Novembro de 2011 04:26
Resposta

srikanth a

Ranking: Regular Member

Mensagens: 142

Data de entrada: 20 de Fevereiro de 2011

Mensagens recentes

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 de Fevereiro de 2012 19:27
Resposta

Paul Cheong

Ranking: New Member

Mensagens: 7

Data de entrada: 2 de Agosto de 2005

Mensagens recentes

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 de Março de 2012 20:54
Resposta

vijay k

Ranking: New Member

Mensagens: 4

Data de entrada: 5 de Março de 2012

Mensagens recentes

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 de Março de 2012 00:01
Resposta

tian ci

Ranking: New Member

Mensagens: 1

Data de entrada: 18 de Março de 2012

Mensagens recentes

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 de Abril de 2012 05:55
Resposta

Srikanth Reddy Sanivarapu

Ranking: Regular Member

Mensagens: 190

Data de entrada: 14 de Novembro de 2008

Mensagens recentes

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 de Abril de 2012 23:40
Resposta

vijay k

Ranking: New Member

Mensagens: 4

Data de entrada: 5 de Março de 2012

Mensagens recentes

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 de Abril de 2012 06:30
Resposta

Jasar Muhiyudheen

Ranking: New Member

Mensagens: 3

Data de entrada: 30 de Abril de 2012

Mensagens recentes

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 de Maio de 2012 13:52
Resposta

vijay k

Ranking: New Member

Mensagens: 4

Data de entrada: 5 de Março de 2012

Mensagens recentes

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 de Maio de 2012 20:59
Resposta

Jasar Muhiyudheen

Ranking: New Member

Mensagens: 3

Data de entrada: 30 de Abril de 2012

Mensagens recentes

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 de Julho de 2012 13:27
Resposta

Ken Driscoll

Ranking: Junior Member

Mensagens: 57

Data de entrada: 2 de Julho de 2012

Mensagens recentes

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 de Julho de 2012 19:25
Resposta

Phap Phan

Ranking: New Member

Mensagens: 5

Data de entrada: 26 de Março de 2012

Mensagens recentes

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 de Julho de 2012 00:17
Resposta

Bart Simpson

Ranking: Liferay Master

Mensagens: 520

Data de entrada: 29 de Agosto de 2011

Mensagens recentes

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 de Agosto de 2012 00:37
Resposta

Robert Seedorff

Ranking: New Member

Mensagens: 3

Data de entrada: 16 de Dezembro de 2010

Mensagens recentes

thx for your post, helped me alot!
Bart Simpson
RE: Custom login portlet
18 de Setembro de 2012 04:43
Resposta

Bart Simpson

Ranking: Liferay Master

Mensagens: 520

Data de entrada: 29 de Agosto de 2011

Mensagens recentes

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 de Setembro de 2012 05:18
Resposta

Mazhar Alam

Ranking: Regular Member

Mensagens: 188

Data de entrada: 25 de Novembro de 2011

Mensagens recentes

helpful post...
David Pereira
RE: Custom login portlet
20 de Setembro de 2012 12:37
Resposta

David Pereira

Ranking: New Member

Mensagens: 11

Data de entrada: 23 de Maio de 2012

Mensagens recentes

Muchas gracias, esto me ha ayudado mucho. Thanks!
Jasar Muhiyudheen
RE: Custom login portlet
8 de Janeiro de 2013 03:05
Resposta

Jasar Muhiyudheen

Ranking: New Member

Mensagens: 3

Data de entrada: 30 de Abril de 2012

Mensagens recentes

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 de Janeiro de 2013 06:55
Resposta

Bart Simpson

Ranking: Liferay Master

Mensagens: 520

Data de entrada: 29 de Agosto de 2011

Mensagens recentes

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 de Março de 2013 03:20
Resposta

Ime Prezime

Ranking: New Member

Mensagens: 4

Data de entrada: 7 de Março de 2013

Mensagens recentes

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 de Março de 2013 07:13
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 1855

Data de entrada: 26 de Julho de 2005

Mensagens recentes

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 de Março de 2013 03:10
Resposta

Ime Prezime

Ranking: New Member

Mensagens: 4

Data de entrada: 7 de Março de 2013

Mensagens recentes

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 de Março de 2013 09:01
Resposta

Vernon Singleton

LIFERAY STAFF

Ranking: Regular Member

Mensagens: 156

Data de entrada: 14 de Janeiro de 2013

Mensagens recentes

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 de Março de 2013 07:00
Resposta

Ime Prezime

Ranking: New Member

Mensagens: 4

Data de entrada: 7 de Março de 2013

Mensagens recentes

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 de Março de 2013 23:35
Resposta

Kumar M

Ranking: New Member

Mensagens: 15

Data de entrada: 12 de Setembro de 2012

Mensagens recentes

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 de Março de 2013 06:51
Resposta

Vernon Singleton

LIFERAY STAFF

Ranking: Regular Member

Mensagens: 156

Data de entrada: 14 de Janeiro de 2013

Mensagens recentes

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 de Março de 2013 07:17
Resposta

Kumar M

Ranking: New Member

Mensagens: 15

Data de entrada: 12 de Setembro de 2012

Mensagens recentes

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 de Março de 2013 10:44
Resposta

Vernon Singleton

LIFERAY STAFF

Ranking: Regular Member

Mensagens: 156

Data de entrada: 14 de Janeiro de 2013

Mensagens recentes

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 de Abril de 2013 02:21
Resposta

Nilesh Gundecha

Ranking: Regular Member

Mensagens: 187

Data de entrada: 30 de Novembro de 2009

Mensagens recentes

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
Anexo

Anexos: Forbidden.png (21,1k)
Nilesh Gundecha
RE: Custom login portlet
16 de Abril de 2013 02:34
Resposta

Nilesh Gundecha

Ranking: Regular Member

Mensagens: 187

Data de entrada: 30 de Novembro de 2009

Mensagens recentes

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 de Setembro de 2013 01:45
Resposta

Christophe Cariou

Ranking: Junior Member

Mensagens: 40

Data de entrada: 1 de Outubro de 2007

Mensagens recentes

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