Maintain Liferay session depending upon session in another website - liferay

Two components
Liferay site
Another web-site on which we do not have any control
What we have
We would be using apache-httpcomponents to login to the website programmatically through Liferay and get the html page after login. Do some HTML parsing and display the page in liferay.
What we need to do (and this is were i need help or pointers)
So what we need to do is this :
User logs in to Liferay giving credentials
He will only be logged-in when the login is successful in the other website programatically.
Once login successful in that application, a session would be created in liferay.
Once the user is idle for a certain period and is logged-out of website it should log the user out from Liferay as well.
User base is the same in both the website and liferay but password in liferay are different and not same as those in the website.
Also is my approach correct when I am using Apache HttpComponents or is there any other way to do this?
Any help in this direction would help.
Thanks
Note: Cross-posted on Liferay Forums - Maintain Liferay session depending upon session in another website

I'm not sure which is your problem. Liferay log out users automatically when they stop interacting for a time.

Related

Unable to modify Hybris B2B Login Page via smartedit

We had a requirement to add create custom components and slots in login page for a B2B portal.
But currently we are facing two issues in it.
-If I try to add any component to the slots created in login page.I am unable to add the components in the newly created slots from smartedit. But if the same is added through impexes it works fine. Is there any restriction for login page slots in Hybris B2B accelerators due to secureportaladdon ?
-Also another issue that we face currently is, while editing the login page via smartedit while changing from draft to ready to sync mode ,the smartedit page is redirected to storefront url with the error refused to connect.
This issue is not encountered in case the user Is logged in and access any page.
-Also we have observed page level sync is not working in case of login page but it works fine for other pages.
Any reference or pointers to the above issue would be of great help.
We are currently using Hybris 2011 version in ccv2 environment. We have seperate instances for storefront,backoffice,hac and smartedit.
1st Issue can be addressed by writing UserAccessRightImpex.
$START_USERRIGHTS
Type;UID;MemberOfGroups;Password;Target;read;change;create;remove;change_perm
UserGroup;cmsmanagergroup;cockpitgroup,employeegroup;;;;;;;
;;;;CustomLeftComponent;+;+;+;+;+;
;;;;CustomRightComponent;+;+;+;+;+;
;;;;CustomMiddleComponent;+;+;+;+;+;
;;;;CustomCMSProductSectionsContainer;+;+;+;+;+;
;;;;CUstomCMSProductSectionTabComponent;+;+;+;+;+;
$END_USERRIGHTS
In above Impex please check which usergroup is applicable for smartedit login.
User--> can have multiple usergroups

Log user into Kentico Admin site based on HttpHeader value from Siteminder

My company has just obtained Kentico for some new applications. These applications will be going into production in about 2 weeks, so we are still fairly new with this. What we have are three ASP.NET MVC applications/sites that format and present content that is stored in Kentico. Additionally, we have specific users who will log into the Kentico9/Admin site to manage the content displayed by the MVC apps.
From a corporate standpoint, we also have Siteminder SSO enabled. When a user navigates to our Kentico9/Admin site, they are first authenticated by our corporate Siteminder SSO form using their corporate user id. When they are successfully authenticated, Siteminder redirects the user to the Kentico9/Admin site they originally requested and the user is presented with the standard Kentico login form. If the user has already logged in through Siteminder during another session, they only get presented with the Kentico login form. Otherwise, if this is their first time logging in, the user is required to login twice (once through Siteminder and again through Kentico).
What I want to do is bypass the standard Kentico login form and use the Siteminder information to Authorize the user to log them into the Kentico admin site. Siteminder adds the username and some other information to the HTTP request headers. Using C#, I can retrieve their corporate user id using the following: System.Web.HttpContext.Current.Request.Headers.Get("SM_USERID").
So, in a nutshell, I want to override Kentico's standard login form and write some code that will get the user id from the HTTP request header and authorize the user by looking up their userid in Kentico. If the user id is not found or is not active, present the user with the standard Kentico login form. Otherwise, if the user is a valid and active user, pull their user record and allow them to access Kentico.
I have found some tidbits of information and given enough time, I may be able to figure something out, but I am hoping someone has done something similar and can speed up my process. Any ideas on what I can do? I will also entertain anything that might have tighter integration with Siteminder, although it doesn't seem Kentico can handle Siteminder out of the box, but I am not sure about that.
Sounds like you might be able to create a custom webpart which you will place on a page and simply have Siteminder redirect the user to the page with that webpart on it and look for those header values on page load. If it finds them, perform your actions within Kentico to look that user up and authenticate them in Kentico as needed. If there are no header values or it can't find the Kentico info, simply send them to the regular login page.
You could also create a global event handler but that would require someone to click a button or such on your site after they have entered credentials.

Setting landing page for different users

I am Using Liferay 6.1CE.
I can able to set my default landing page to a site in control panel.
But in my portal 2 sites are there,two users are there.
For eg: userA is a member of siteA,simularly UserB member of siteB.
How can i redirect the users to their site after login.
What can i do?
I guess 2 sites you mean two communities. Anyway you need to create post login action where you'll check your conditions and redirect where needed.
You can create the Liferay hook for your custom login post action. Please have a look at :
custom action using hook
on how to create the hook.
In the hook, you can identify the looged in user based on your search criteria and redirect to the relevant community.

Liferay's default guest page and it's purpose in a Website

I'm currently building a website for a company, that will for the moment contain 3-5 static pages (i.e, just content). User registration may be added in time to come.
Now, I've been reading through the Liferay docs, forums and wiki, and I'm still pretty unclear on the approach to take in designing this website:
If I were to model my company Website as an organization in Liferay where I would have the public pages of the Website, what would be the purpose of the default guest page? (/web/gues/home)? Do I remove this and redirect the guest to my organization? If so, how do I do this?
Who is the creator of an organization in the real world? Is this site administrator? or the person responsible for adding content?
Who is the creator of an organization in Liferay? Is this the administrator to Liferay (i.e the default Test user)?
The best way to do is is to put your pages in the Public Pages of your organization and setup a virtual host (see Manage Pages -> Virtual Hosts in the Control Panel) for those pages. This way, www.my-homepage.com will redirect to the public pages of your organization. You should of course be owner of the domain and link the domain to the IP address of the server the website runs on.
In Liferay, by default only users with the role of Administrator can add organizations. For managing content you should setup other roles. Create f.e. a Content Editor role and add permissions for the Web Content portlet (Create Content, Approve, Edit, Delete, View in Control Panel). This also answered your third question.
Add this lines of code in your portal-ext.properties
mail.session.mail.pop3.host=pop.gmail.com
mail.session.mail.pop3.password=PASSWORD
mail.session.mail.pop3.port=110
mail.session.mail.pop3.user=USER
mail.session.mail.imap.host=imap.gmail.com
mail.session.mail.imap.port=993
mail.session.mail.store.protocol=imap
mail.session.mail.transport.protocol=smtp
mail.session.mail.smtp.host=smtp.gmail.com
mail.session.mail.smtp.password=PASSWD
mail.session.mail.smtp.user=USERID#gmail.com
mail.session.mail.smtp.port=465
mail.session.mail.smtp.auth=true
mail.session.mail.smtp.starttls.enable=true
mail.session.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
Please user your password in place of PASSWD and your gmail user id in place of USERID.
By three different ways we can configure mail server in Liferay. I am using Liferay 6.2 and initially I got an error that could not connect to smtp host localhost port 25 in liferay by using different code. So I used above code and my mail server is configured properly and my application is able to send mail to the user in forgot password case.
And please see this link. This link help me to solve the issue.
https://www.permeance.com.au/web/tim.telcik/home/-/blogs/how-do-i-configure-liferay-portal-to-use-google-mail
Thanks
asif aftab

Liferay - Custom Authentication Web Service. Do not need user info in liferay db

I have followed Custom Authentication Web Service link to customize authentication.
But Liferay is still checking whether the same user email id is configured in the liferay db or not. If its not, it is saying that authetication failed.
I do not want to keep any user information in the liferay db. Do any one know how to do that?
Regards
Vishal G
Create dummy users for your real users with fake data. Liferay requires some sort of Liferay user in the database to function correctly. You can create one dummy user for each real user or one dummy user for all your users depending on your needs.

Resources