Bug 1145125

Summary: Set JASPI without login-module-stack causes NPE
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Ondrej Lukas <olukas>
Component: SecurityAssignee: Stefan Guilhen <sguilhen>
Status: CLOSED CURRENTRELEASE QA Contact: Pavel Slavicek <pslavice>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4.0CC: anmiller, jkudrnac, kkhan, sguilhen
Target Milestone: DR11   
Target Release: EAP 6.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-19 12:46:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
test app none

Description Ondrej Lukas 2014-09-22 12:32:44 UTC
Created attachment 939983 [details]
test app

It is caused by missing null value check for CallerPrincipalCallback in authenticate method of WebJASPIAuthenticator.

Steps to reproduce:
1) add following security domain:
<security-domain name="jaspi">
    <authentication-jaspi>
        <auth-module code="org.jboss.as.test.integration.security.jaspi.SuccessAuthModule" flag="required"/>
    </authentication-jaspi>
</security-domain>

2) start standalone server and deploy test.war

3) hit http://localhost:8080/test/SimpleSecuredServlet - you will see NPE in server log:

ERROR [org.apache.catalina.connector] (http-/127.0.0.1:8080-1) JBWEB001018: An exception or error occurred in the container during the request processing: java.lang.NullPointerException
	at org.jboss.as.web.security.jaspi.WebJASPIAuthenticator.authenticate(WebJASPIAuthenticator.java:128) [jboss-as-web-7.5.0.Final-redhat-2.jar:7.5.0.Final-redhat-2]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [jbossweb-7.5.0.Beta1.jar:7.5.0.Beta1]
	at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.5.0.Final-redhat-2.jar:7.5.0.Final-redhat-2]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.5.0.Beta1.jar:7.5.0.Beta1]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.5.0.Beta1.jar:7.5.0.Beta1]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.5.0.Beta1.jar:7.5.0.Beta1]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) [jbossweb-7.5.0.Beta1.jar:7.5.0.Beta1]
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:855) [jbossweb-7.5.0.Beta1.jar:7.5.0.Beta1]
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.5.0.Beta1.jar:7.5.0.Beta1]
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) [jbossweb-7.5.0.Beta1.jar:7.5.0.Beta1]
	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_55]

Comment 2 Kabir Khan 2014-11-24 08:22:45 UTC
https://github.com/jbossas/jboss-eap/pull/2034

Comment 3 FIlip Bogyai 2014-11-28 10:07:04 UTC
Verified in EAP 6.4.0.DR11