You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by zog45 <pa...@yahoo.co.uk> on 2008/09/25 18:54:08 UTC
Realm tag outside server.xml -- urgent question
I have not been able to get my Realm to work in context.xml - my Java trainer
insists I put Realm tag in context.xml - but can this be done?
Can anyone help me?
CONTEXT.XML
<!-- <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@oracle.fdmgroup.com:1521:campus"
connectionName="paulbickell"
connectionPassword="pb12vlS3"
userTable="users" userNameCol="XXXX" userCredCol="YYYYYY"
userRoleTable="user_roles" roleNameCol="role_name"/> -->
WEB.XML
<servlet>
<servlet-name>WebControl</servlet-name>
<servlet-class>com.fdm.servlet.control.ControlServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>WebControl</servlet-name>
<url-pattern>/Control.do</url-pattern>
</servlet-mapping>
<security-constraint>
<display-name>Example Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Guest Area</web-resource-name>
<!-- Define the context-relative URL(s) to be protected -->
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>GUEST</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.htm</form-login-page>
<form-error-page>/errorPage.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>GUEST</role-name>
</security-role>
--
View this message in context: http://n2.nabble.com/Realm-tag-outside-server.xml-----urgent-question-tp1118649p1118649.html
Sent from the JSecurity User mailing list archive at Nabble.com.
Re: Realm tag outside server.xml -- urgent question
Posted by Les Hazlewood <lh...@apache.org>.
I think you've mistaken a Tomcat Realm for a JSecurity Realm - they are not
the same (although their function is parallel in nature).
In web environments you usually define JSecurity Realm(s) in web.xml in a
JSecurityFilter definition. In this case, your context.xml file is
Tomcat-specific and unrelated to JSecurity.
Also, JSecurity doesn't use any of the servlet XML elements
(security-constraint, login-config, etc), since JSecurity's mechanism for
configuration is _much_ more powerful, succinct, and easier to use. Well,
that, and no one has actually requested that we support JEE Servlet XML
elements since I presume everyone likes our format much better.
So, it looks like you need Servlet/Tomcat specific set up unrelated to
JSecurity. I'm afraid I can't be of much help there ;)
On Thu, Sep 25, 2008 at 1:06 PM, zog45 <pa...@yahoo.co.uk> wrote:
>
> Correction - the correct realm tag was:
>
> <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
> driverName="oracle.jdbc.driver.OracleDriver"
> connectionURL="jdbc:oracle:thin:@oracle.fdmgroup.com:1521:campus"
> connectionName="paulbickell"
> connectionPassword="pb12vlS3"
> userTable="users" userNameCol="user_name" userCredCol="user_pass"
> userRoleTable="user_roles" roleNameCol="role_name"/>
>
>
>
>
> zog45 wrote:
> >
> > I have not been able to get my Realm to work in context.xml - my Java
> > trainer insists I put Realm tag in context.xml - but can this be done?
> > Can anyone help me?
> >
> >
> >
> > CONTEXT.XML
> > <!-- <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
> > driverName="oracle.jdbc.driver.OracleDriver"
> > connectionURL="jdbc:oracle:thin:@oracle.fdmgroup.com:1521:campus"
> > connectionName="paulbickell"
> > connectionPassword="pb12vlS3"
> > userTable="users" userNameCol="XXXX" userCredCol="YYYYYY"
> > userRoleTable="user_roles" roleNameCol="role_name"/> -->
> >
> >
> >
> > WEB.XML
> > <servlet>
> > <servlet-name>WebControl</servlet-name>
> >
> > <servlet-class>com.fdm.servlet.control.ControlServlet</servlet-class>
> > </servlet>
> > <servlet-mapping>
> > <servlet-name>WebControl</servlet-name>
> > <url-pattern>/Control.do</url-pattern>
> > </servlet-mapping>
> >
> > <security-constraint>
> > <display-name>Example Security Constraint</display-name>
> > <web-resource-collection>
> > <web-resource-name>Guest Area</web-resource-name>
> > <!-- Define the context-relative URL(s) to be protected -->
> > <url-pattern>/*</url-pattern>
> > <http-method>GET</http-method>
> > <http-method>POST</http-method>
> > </web-resource-collection>
> > <auth-constraint>
> > <role-name>GUEST</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.htm</form-login-page>
> > <form-error-page>/errorPage.jsp</form-error-page>
> > </form-login-config>
> > </login-config>
> > <security-role>
> > <role-name>GUEST</role-name>
> > </security-role>
> >
> >
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/Realm-tag-outside-server.xml-----urgent-question-tp1118649p1118683.html
> Sent from the JSecurity User mailing list archive at Nabble.com.
>
>
Re: Realm tag outside server.xml -- urgent question
Posted by zog45 <pa...@yahoo.co.uk>.
Correction - the correct realm tag was:
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@oracle.fdmgroup.com:1521:campus"
connectionName="paulbickell"
connectionPassword="pb12vlS3"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name"/>
zog45 wrote:
>
> I have not been able to get my Realm to work in context.xml - my Java
> trainer insists I put Realm tag in context.xml - but can this be done?
> Can anyone help me?
>
>
>
> CONTEXT.XML
> <!-- <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
> driverName="oracle.jdbc.driver.OracleDriver"
> connectionURL="jdbc:oracle:thin:@oracle.fdmgroup.com:1521:campus"
> connectionName="paulbickell"
> connectionPassword="pb12vlS3"
> userTable="users" userNameCol="XXXX" userCredCol="YYYYYY"
> userRoleTable="user_roles" roleNameCol="role_name"/> -->
>
>
>
> WEB.XML
> <servlet>
> <servlet-name>WebControl</servlet-name>
>
> <servlet-class>com.fdm.servlet.control.ControlServlet</servlet-class>
> </servlet>
> <servlet-mapping>
> <servlet-name>WebControl</servlet-name>
> <url-pattern>/Control.do</url-pattern>
> </servlet-mapping>
>
> <security-constraint>
> <display-name>Example Security Constraint</display-name>
> <web-resource-collection>
> <web-resource-name>Guest Area</web-resource-name>
> <!-- Define the context-relative URL(s) to be protected -->
> <url-pattern>/*</url-pattern>
> <http-method>GET</http-method>
> <http-method>POST</http-method>
> </web-resource-collection>
> <auth-constraint>
> <role-name>GUEST</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.htm</form-login-page>
> <form-error-page>/errorPage.jsp</form-error-page>
> </form-login-config>
> </login-config>
> <security-role>
> <role-name>GUEST</role-name>
> </security-role>
>
>
>
>
--
View this message in context: http://n2.nabble.com/Realm-tag-outside-server.xml-----urgent-question-tp1118649p1118683.html
Sent from the JSecurity User mailing list archive at Nabble.com.