掲示板

Custom authentication inside Liferay

12年前 に Edward Cruise によって更新されました。

Custom authentication inside Liferay

New Member 投稿: 9 参加年月日: 11/02/03 最新の投稿
Hi,
I have a question about authetication on Liferay.
I have a public page with a custom portlet into. Such a portlet autheticates user into a system, it takes username and password, and check into db if user is present.
If present returns an object with user credentials, null otherwise.

Supposing that I include the portlet into my page, can I retrieve portlet result and display 'Welcome <username>" message in my page after successfully authetication or "Username or password incorrect" message otherwise ?

This is a simple example I would like to generate different menu choosing right menu item for example, based on user role.

In this way I would use my custom authetication inside liferay that has its own authetication mechanism. Is this way correct ?
Does exist a best practice for this case ?

Thanks in advance.
Regards edcruise
thumbnail
12年前 に David H Nebinger によって更新されました。

RE: Custom authentication inside Liferay

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Authentication will just ensure the user can access the system.

The user must still exist in the Liferay database (to satisfy foreign keys), so since the user is logged in you can access their user id and name.
12年前 に Edward Cruise によって更新されました。

RE: Custom authentication inside Liferay

New Member 投稿: 9 参加年月日: 11/02/03 最新の投稿
Thanks for your answer...
So you say that user must exist in the liferay database...but in this way I must duplicate user data and create synchronization mechanism....Is not possible to avoid it ?
And what do yo mean for foreign key ?

Technically, if I could save resulting object in session, and if I could insert custom code into public page, and could access session data, I could implement what I want...

Thanks in advance, and again, I apologize if my question is trivial.
Regards,
edcruise
thumbnail
12年前 に David H Nebinger によって更新されました。

RE: Custom authentication inside Liferay

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Users must exist in the liferay database.

Liferay assigns each user a user id (also stored in the database). Anything the user adds (forum post, wiki comment, document upload, etc.) has the user id as a foreign key, so the user must exist.

Organization/community/group/team membership also uses the user id. Roles also have a dependency on user id.

So yes, you must have a sync mechanism. Check out the LDAP code in Liferay; Liferay can use LDAP for authentication, but still needs the sync process to populate Liferay's user table.

No, there's absolutely no way around it.
12年前 に Edward Cruise によって更新されました。

RE: Custom authentication inside Liferay

New Member 投稿: 9 参加年月日: 11/02/03 最新の投稿
Thanks again.
Maybe I have no clarified the context.

This application, liferay based, will contain custom portlets that interact with a system.
Users that access this portals, will display information (created with public page) and will use such portlets. They will not add nothing to this site (no forum post, no wiki comment, no document upload, etc.), will have only the chance to use these portlets browsing web pages.

For example, another custom portlet will show a list of items connected to a user. After login, user can access this portlet which will extract from database such items. So, list portlet will work only if it will find userid somewhere available.
So, I would like to know if it is possible to manage such a portlets to realize custom interaction.


edcruise
thumbnail
12年前 に David H Nebinger によって更新されました。

RE: Custom authentication inside Liferay

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Again, your particular planned usage has nothing to do with the Liferay requirement that users exist in the Liferay database.

Satisfy that requirement and you'll be just fine. Try to work around or avoid that requirement, and you're looking at a lot of pain and anguish trying to rework much of the Liferay core to hack it in.

Take the easy road and create the users in the Liferay database, either manually or automatically (via your auth mechanism).
12年前 に Edward Cruise によって更新されました。

RE: Custom authentication inside Liferay

New Member 投稿: 9 参加年月日: 11/02/03 最新の投稿
Ok,
I will explore your road to realize this work.

And what about adding custom code into public page ? Is it possible ? Suppose I have a template page in which I want to add some custom code based on user role....Can I write my code into template and then rendering the page ?

edcruise