Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

ganesh boil

Greenhorn
+ Follow
since Sep 17, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ganesh boil

Hi team,
I have an application like a shopping cart.
Here I have a table for orders.
And I want to send an email notification to the user with his order details immediately after placing the order.
So can anyone suggest me the way to achieve this? What are the api do I need to use?

And anybody had the code snippet that will be more helpful.

Thanks in advance..

Ganesh
10 years ago
Hi Ulf Dittmer,
thanks for your reply.
But actually I'm not able to spend that much money.

Thanks for your time.
Hi team,

I need books like "programming with portlets" by Cameron McKenzie.

NOTE: Any other portlet booka are also helpful.

Thanks in advance!!!
Ganesh
Hi Ankur,
This is a nice tutorial.
We are using Liferay Portal and try to use some jsf portlets.
To develope portlets we completely use SUN portlet API.

So here I have two questions.

1. Which portlet class to be used for liferay jsf portlets (These portlets are using sun portlet API).
2. Which portlet class to be used for liferay jsf portlets (If we use liferay Portlet API instead SUN api).

Thanks in advance!!
10 years ago
Hi team,
I'm looking for an sample portlet application (Simple JSPs ) which store the data in database.
I don't know how to call a method(form submission) in jsp of a portlet.
So can anyone give me sample code to store the data in database.

Thanks and Regards,
Ganesh
10 years ago
Hi Drazen,
Thanks for your reply. I didnot understand your 1st point.
I mean in which file do i need to add ou=xxx.
my scenario is just i want to add an attribute named "groupMembership" to "inetOrgPerson" schema.
I'm using ldap admin as ldap client.
do i need to add it through client or in any other configuration file which is available in Apache DS installation ?
10 years ago
Hi Team,
I'm using Apache DS 1.5.5 version.
As part of my new requirement I want to add a new attribute called "groupMembership" to the "inetOrgPerson" schema.
But i did not find any .schema files in the installation.
So can anyone suggest me the answers for the following questions.

1.How to add a new attribute to the existed schema file for ex: inetOrgPerson

2.where to place a new schema file and object class file.

3.And 3rd one is, I want to add a new domain like, o=xxx, dc=test, dc=com. In which file i need to add these new domain.

Thanks in advance.

Regards,
Ganesh
10 years ago
Yes Holloway,
You are right whenever we are trying to access the login page directly by url like http://localhost:8080/APPLICATION_NAME/login.jsp then it is showing error. So we should use http://localhost:8080/APPLICATION_NAME/protected/success.jsp then automatically it will redirect to the login.jsp page.

This is fine and works great. now my problem is, I don't know whether it is possible or not.

let us say, I'm having two roles like admin and user. ADMIN.jsp is the home page for admin role people and USER.jsp is the home page for the people who have the role called user these two pages are in a folder named "jsp".

for this what i'm doing is after login, the application will redirect to success.jsp, in this jsp i'm checking the roles and redirecting to appropriate home page.

now i'm trying to login with user role and seeing the user.jsp and in the url i'm pasting the follwoing usrl without killing the session.

http://localhost:8080/APPLICATION_NAME/jsp/ADMIN.jsp (Actually this page is for admin users only. remember i'm not loggedin with admin credentials). then i'm seeing the ADMIN page. to prevent this i made a filter which is responsible for killing the current session and redirecting to the success.jsp wheever we are trying to access the pages (any pages) using the urls like above. So my problem i.e loggedin with user credentials and seeing the admin.jsp using (url) has been resolved.

Now the second problem is started, now i'm loggedin with admin credentials http://localhost:8080/protected/success.jsp or even with the above url (because of filter), so automatically i'm redirecting to ADMIN.jsp.

but in the url i'm seeing http://localhost:8080/protected/success.jsp only. After logged i'm trying to access the ADMIN.jsp by pasting the follwoing url without logout means without session killing. http://localhost:8080/APPLICATION_NAME/jsp/ADMIN.jsp. Now also it is redirecting me to login page through the success.jsp url. this is also because of filter. But i want to see the ADMN.jsp page using url (ofcourse after loggedin with admin role). Is it possible. the follwoing is my filter.





and web.xml is




So how can i achieve my requirement.

Thanks again for your valuable time.


11 years ago
Hi Holloway.
Good Morning!!!
Thanks for giving the deep details of container managed security. Now I got a clear idea about it. And my application is working almost 75% with a small configuration mistake.

Because of lack of knowledge on Realm settings I'm not able to get what I want.
What i have done is i have been created a folder called "protected" under root folder of my application. And kept a page named with success.jsp.
And the following is my web.xml.


<security-constraint>
<display-name>Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Apache_Realm</web-resource-name>
<!-- Define the context-relative URL(s) to be protected -->
<url-pattern>/protected/*</url-pattern>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
<!-- If you list http methods, only those methods are protected -->
</web-resource-collection>
<auth-constraint>
<!-- Anyone with one of the listed roles may access this area -->
<role-name>AppUsers</role-name>
</auth-constraint>
</security-constraint>

<!-- Default login configuration uses form-based authentication -->
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Form-Based Authentication Area</realm-name>
<form-login-config>
<form-login-page>
/index.jsp
</form-login-page>
<form-error-page>
/error.jsp
</form-error-page>
</form-login-config>
</login-config>


<!-- Security roles referenced by this web application -->
<security-role>
<role-name>AppUsers</role-name>
<role-name>Admin</role-name>
<role-name>AppAdmin</role-name>
<role-name>Manager</role-name>
</security-role>


If i enter wrong credentials which are not there in ldap then it is working fine means redirecting to the error.jap. After entering the right credentials it is not redirecting or showing the success.jsp. instead of this it is showing the following error.

"HTTP Status 400 - Invalid direct reference to form login page"


I'm using Tomcat 5.5.27... Is it tomcat problem? or my configuration problem?

can you suggest me the errors.

Thanks again for your help.

Regards,
Ganesh
11 years ago
Hi Holloway,Thanks for your reply.
I think the following codwe can do my requirement.

Like this I need to metion several roles and corresponding urls? AM i right? And after authentication is hav\ppeng successfully, then the home page is not displaying? I think I did a mistake in some where. After login ais successfull , how to redirect or call a controller i.e a servlet. Do i need to mention the <url-pattern> in the above code ?




fo example I want to call the Servlet named LoginServelt , In this servlet I will find the role then dispatch the request appropriately..




for calling this servlet how to code in web.xml



I think in the above instead of this do i need to use like this? or something else.

can you make changes in the above code appropriately... My plan is in this LoginServlet I will check the appropriate role and enable the features in home page. Is it a right way to achieve the role based authentication ? Please guide me ...

Thanks again for your support. Have a nice week end... will catch you on Monday...

Bye,
Ganesh

11 years ago
Hi Holloway,
Thanks for your reply.
If i didn't able to get the roles then how can i redirect the user to appropriate page ?
let us say I have an application where user can see user page and admin can see admin page.
Let us assume there are two uses namely user1 and admin1 and two roles USER, ADMIN. the user1 belongs to USER role/group and admin1 belongs to ADMIN role/group in LDAP. And in my application there are typically two pages one is user.jsp and another is admin.jsp.

If user1 is logged in then i need to redirect to user.jsp, for admin, admin.jsp.

how can I achieve this?
11 years ago
Hi Holloway,

thnaks for your response. can you have a loot into my full post at https://coderanch.com/t/463042/Security/redirect-success-page-tomcat-using

Regards,
Ganesh
11 years ago
Hi Team,
I want to configure LDAP in tomcat using tomcats's Realm.
for this i'm doing like below.

my server.xml (inside tomcat/conf) is,



and my web.xml (inside my web application) file is,


and my index.jsp is,


This what i have done,
Now After authentication is success, I want to redirect to the success page and where i want to display the user name and its role.
So can anyone tell me how to redirect to the success page from index.jsp. And how to get the roles from ldap using tomcat ldap configurations.

thanks in advance,
Regards,
Ganesh
11 years ago
Hi,
recently i have been started to make a POC on Apache Tomcat JNDIRealm.
For this i have followed the tutorial available at

http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#JNDIRealm and

http://viralpatel.net/blogs/2008/12/implement-ldap-authentication-in-tomcat-jboss-server-for-java-app.html

I have created a couple of users and groups in openldap. And configures server.xml in tomcat as suggested in the above link.
And configured web.xml in my j2ee application as suggested in the second url.

Now my question is how to get the user credentials in .java file where i have login() method.
So can anyone suggest me how to get user name and password from ldap using thios Tomcat JNDIRealm.

Any sample code is more helpful.

Thanks in advance.

regards,
Ganesh
11 years ago