Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Edvinas Bazaras
Using LoginUtil in portlet
June 27, 2012 6:08 AM
Answer

Edvinas Bazaras

Rank: New Member

Posts: 7

Join Date: June 27, 2012

Recent Posts

Hello everybody,

How do I use LoginUtil's inside my custom portlet?
Now if I try to use this, I get freakin' class not found exception... what the hell?

What do I want:
Simple task PRESS THE BUTTON -> LOGIN;

I will repeat this slowly, please don't ask why I need this:
1) Me open liferay portal
2) Me see da login buttonzzz
3) Me click da button
4) Me iz logged in!

Is it clear enough? Click -> Logged in;
Why can't you have such a simple example?

Rhetorical question for the end: does liferay makes you swear?
David H Nebinger
RE: Using LoginUtil in portlet
June 27, 2012 6:52 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8560

Join Date: September 1, 2006

Recent Posts

LoginUtil is an internal part of Liferay and is not exposed to external plugins.

You might think this is a bad thing, but it does ensure that you don't inadvertently drop a plugin into your installation that allows a remote user to automagically log in (i.e. when the new marketplace goes live, and you get a 'free' plugin for playing solitaire but it's actually a trojan the remote hacker can now use to log into your Liferay environment).

Perhaps rather than posting your "kewl kid" speak, you could formulate a post indicating what you're trying to do and what you're struggling with. Or even try searching the forums since there have been many posts lately dealing with customizing the login portlet...

Answer to rhetorical question: No, Liferay doesn't make me swear, but some posts on the forum do...
Edvinas Bazaras
RE: Using LoginUtil in portlet
June 27, 2012 7:06 AM
Answer

Edvinas Bazaras

Rank: New Member

Posts: 7

Join Date: June 27, 2012

Recent Posts

Sorry for harsh tone in my first post, but its insane when I find hundreds of posts with the same problem I am struggling at and no working solution...

I will describe as clear as possible what do I want:
1) I want to create kinda empty portlet with single jsp page and button like:
<h1>Hello World</h1>
<form method="GET">
<input type="hidden" name="doYouWantToLogginWithoutPasswordAndUserName" value="yes"/>
<button>CLICK ME TO LOGIN </button>
</form>

2) I want to click that button

3) After clicking that button I really need to be logged in without user name and password.

Some preconditions: -lets say I am going to hard-code username and password inside MyMagicLoginAction;

and... lets say we check "doYouWantToLogginWithoutPasswordAndUserName" value inside MyMagicLoginAction;
if it is "yes" we, are logged in.

Btw, I am dealing with LR 6.1 GA1;
David H Nebinger
RE: Using LoginUtil in portlet
June 27, 2012 7:20 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8560

Join Date: September 1, 2006

Recent Posts

I'm sure I haven't see hundreds of posts with people trying to do a fake login, but that's neither here nor there...

The only way you're going to be able to access LoginUtil is via an EXT plugin (that's how you merge code into the portal core).

Although it is said to be deprecated, you should be able to create your portlet within the EXT plugin project and deploy it that way.
Edvinas Bazaras
RE: Using LoginUtil in portlet
June 27, 2012 7:33 AM
Answer

Edvinas Bazaras

Rank: New Member

Posts: 7

Join Date: June 27, 2012

Recent Posts

Fake log-in is the key to make any other kind of log-in.

Correct me if I am wrong, but are you telling me that log-in portlet(inside portal-impl jar) is liferay's core feature and can be overridden in no other way, but ext plugin?

Is it the same if I want to create some new "dummy" user by using GET method like: ?action=CREATE_ME_USER_PLEASE&username=my_name&hash=SOME_SIGNATURE_TO_CHECK_VALIDITY

In short: is user creation core feature as well and can only be overridden with ext plugin?
David H Nebinger
RE: Using LoginUtil in portlet
June 27, 2012 7:57 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8560

Join Date: September 1, 2006

Recent Posts

User creation can be done using the UserLocalServiceUtil functionality outside of EXT, in fact any plugin can do it.

Overriding the login portlet JSP can be done using a hook, and does not require an EXT plugin.

However, if you want to create your very own login portlet (which your post seemed to indicate), you would need to do that via an EXT plugin in order to be able to access the LoginUtil functionality.
Edvinas Bazaras
RE: Using LoginUtil in portlet
June 27, 2012 8:06 AM
Answer

Edvinas Bazaras

Rank: New Member

Posts: 7

Join Date: June 27, 2012

Recent Posts

Thank you for clear answers.
Looks like I found the right solution with your help,
I appreciate that.
Have a nice day. emoticon