You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by ttiurani <ti...@iki.fi> on 2010/06/07 15:15:11 UTC

Re: issue deploying webapp with security realm


Unfortunately I ran into more problems with deploying a custom security
realm inside an ear to Geronimo 2.2. Even though I am now able to
successfully deploy the security realm to G22, I can not get a reference to
the LoginModule. This is the stack trace I get:

javax.security.auth.login.LoginException: No LoginModules configured for
MySecurityRealm
        at
javax.security.auth.login.LoginContext.init(LoginContext.java:256)
        at
javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
        at
javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
        at org.test.MyFilter.doFilter(MyFilter.java:32)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at
org.apache.geronimo.tomcat.security.SecurityValve.invoke(SecurityValve.java:88)
        at
org.apache.geronimo.tomcat.security.jacc.JACCSecurityValve.invoke(JACCSecurityValve.java:54)
        at
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:420)
        at
org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:361)
        at org.apache.geronimo.pool.ThreadPool$1.run(ThreadPool.java:214)
        at
org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(ThreadPool.java:344)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)

Here is an extended test program that produces the error on Geronimo 2.2 but
works fine on 2.1.3, 2.1.4 and 2.1.5 with Java 1.6.0_18. Run "mvn:verify" to
see the error:

    http://apache-geronimo.328035.n3.nabble.com/file/n876229/g22srbug.zip
g22srbug.zip 

The test program now includes a MyFilter.java that is called before
http://localhost:8080/testwar/index.html is loaded. LoginException is thrown
for:

        LoginContext lc = new LoginContext(
					this.realm, 
					new Subject(), 
					new MyCallbackHandler());

Is there a way around this class loading problem?

-- Timo
-- 
View this message in context: http://apache-geronimo.328035.n3.nabble.com/issue-deploying-webapp-with-security-realm-tp334180p876229.html
Sent from the Users mailing list archive at Nabble.com.

Re: issue deploying webapp with security realm

Posted by ttiurani <ti...@iki.fi>.

Ivan Xu wrote:
> 
> Sorry, I forgot to mention it in the last email, you might need to add a
> global gbean attribute for realm.
> <dep:attribute name="global">true</dep:attribute>
> 

Thanks again Ivan! This configuration file now works for G2.2.:

<dep:gbean name="MySecurityRealm"
		class="org.apache.geronimo.security.realm.GenericSecurityRealm"
		xsi:type="dep:gbeanType"
		xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
		<dep:attribute name="realmName">MySecurityRealm</dep:attribute>
		<dep:attribute name="global">true</dep:attribute>
		<dep:reference name="ServerInfo">
			<dep:name>ServerInfo</dep:name>
		</dep:reference>
		<dep:xml-reference name="LoginModuleConfiguration">
			<log:login-config
xmlns:log="http://geronimo.apache.org/xml/ns/loginconfig-2.0">
				<log:login-module control-flag="REQUIRED"
					wrap-principals="false">
					<log:login-domain-name>
						MySecurityRealm
					</log:login-domain-name>
					<log:login-module-class>
						org.test.MyLoginModule
					</log:login-module-class>
				</log:login-module>
			</log:login-config>
		</dep:xml-reference>
	</dep:gbean>

-- Timo
-- 
View this message in context: http://apache-geronimo.328035.n3.nabble.com/issue-deploying-webapp-with-security-realm-tp334180p876453.html
Sent from the Users mailing list archive at Nabble.com.

Re: issue deploying webapp with security realm

Posted by Ivan <xh...@gmail.com>.
Sorry, I forgot to mention it in the last email, you might need to add a
global gbean attribute for realm.
<dep:attribute name="global">true</dep:attribute>

2010/6/7 ttiurani <ti...@iki.fi>

>
>
> Unfortunately I ran into more problems with deploying a custom security
> realm inside an ear to Geronimo 2.2. Even though I am now able to
> successfully deploy the security realm to G22, I can not get a reference to
> the LoginModule. This is the stack trace I get:
>
> javax.security.auth.login.LoginException: No LoginModules configured for
> MySecurityRealm
>        at
> javax.security.auth.login.LoginContext.init(LoginContext.java:256)
>        at
> javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
>        at
> javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
>        at org.test.MyFilter.doFilter(MyFilter.java:32)
>        at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>        at
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>        at
>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>        at
>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>        at
>
> org.apache.geronimo.tomcat.security.SecurityValve.invoke(SecurityValve.java:88)
>        at
>
> org.apache.geronimo.tomcat.security.jacc.JACCSecurityValve.invoke(JACCSecurityValve.java:54)
>        at
>
> org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:420)
>        at
>
> org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
>        at
>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>        at
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>        at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
>        at
>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>        at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>        at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>        at
>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>        at
>
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:361)
>        at org.apache.geronimo.pool.ThreadPool$1.run(ThreadPool.java:214)
>        at
>
> org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(ThreadPool.java:344)
>        at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>        at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>        at java.lang.Thread.run(Thread.java:619)
>
> Here is an extended test program that produces the error on Geronimo 2.2
> but
> works fine on 2.1.3, 2.1.4 and 2.1.5 with Java 1.6.0_18. Run "mvn:verify"
> to
> see the error:
>
>    http://apache-geronimo.328035.n3.nabble.com/file/n876229/g22srbug.zip
> g22srbug.zip
>
> The test program now includes a MyFilter.java that is called before
> http://localhost:8080/testwar/index.html is loaded. LoginException is
> thrown
> for:
>
>        LoginContext lc = new LoginContext(
>                                        this.realm,
>                                        new Subject(),
>                                        new MyCallbackHandler());
>
> Is there a way around this class loading problem?
>
> -- Timo
> --
> View this message in context:
> http://apache-geronimo.328035.n3.nabble.com/issue-deploying-webapp-with-security-realm-tp334180p876229.html
> Sent from the Users mailing list archive at Nabble.com.
>



-- 
Ivan