JAAS com JBoss 5

9 respostas
rafaelvalerini

Pessoal, seguinte:
Estou criando uma aplicação utilizando JAAS para autenticação no JBOSS 5, onde utilizo o framework JSF.

Configurei o arquivo login-config.xml do jboss:

<application-policy name="CNULogin">
    <authentication>
      <login-module code="br.rvp.loginmodule.CNULoginModule" flag="required">
	    <module-option name="dsJndiName">java:jdbc/icsDS</module-option>   
            <module-option name="principalsQuery">SELECT SENHA FROM USUARIO WHERE USER_LOGIN=?</module-option>   
            <module-option name="rolesQuery">SELECT RC.nm_role FROM USUARIO U, ROLE_CAU RC, USUARIO_ROLE UR WHERE U.ID_USUARIO = UR.ID_USUARIO AND RC.ID_ROLE = UR.ID_ROLE_CNU AND U.USER_LOGIN=?</module-option>  
      </login-module>
    </authentication>
  </application-policy>

e no meu web.xml

<login-config>
		<auth-method>FORM</auth-method>
		<realm-name>CNULogin</realm-name>
		<form-login-config>
			<form-login-page>/login.jsf</form-login-page>
			<form-error-page>/error_login.jsf</form-error-page>
		</form-login-config>
	</login-config>
	<security-constraint>
		<web-resource-collection>
			<web-resource-name>
				Restricted to Secure role
			</web-resource-name>
			<description>Declarative security</description>
			<url-pattern>/*</url-pattern>
			<http-method>HEAD</http-method>
			<http-method>GET</http-method>
			<http-method>POST</http-method>
			<http-method>PUT</http-method>
			<http-method>DELETE</http-method>
		</web-resource-collection>
		<auth-constraint>
			<role-name>UserSGDT</role-name>
		</auth-constraint>
	</security-constraint>
	
	<security-role>
		<role-name>UserSGDT</role-name>
	</security-role>

mas…

9 Respostas

rafaelvalerini

tambem configurei a minha página utilizando Faceles e JSF, da seguinte forma:

...
<tr>
		<td colspan="3" height="25px"></td>
	</tr>	
	<tr>
		<td align="right" class="geralLabel" width="130px">Usuário:</td>				<td width="3px"></td>							<td><input type="text" name="j_username" class="geralInput" maxlength="20" style="width:170px"/></td>								</tr>									<tr>										<td colspan="3" height="10px"></td>						</tr>										<tr>										<td align="right" class="geralLabel">Senha:</td>							<td width="3px"></td>								<td><input type="password" name="j_password" class="geralInput" maxlength="20"/></td>									</tr>									<tr>										<td colspan="3" height="10px"></td>						</tr>		
...

com um botão tipo submit.

mas ao executar o projeto, ele redireciona para a página de login corretamente, mas ao clicar no botão submit, ele me apresenta o erro abaixo:

11:36:22,054 ERROR [UsersRolesLoginModule] Failed to load users/passwords/role files
java.io.IOException: No properties file: users.properties or defaults: defaultUsers.properties found
	at org.jboss.security.auth.spi.Util.loadProperties(Util.java:198)
	at org.jboss.security.auth.spi.UsersRolesLoginModule.loadUsers(UsersRolesLoginModule.java:186)
	at org.jboss.security.auth.spi.UsersRolesLoginModule.createUsers(UsersRolesLoginModule.java:200)
	at org.jboss.security.auth.spi.UsersRolesLoginModule.initialize(UsersRolesLoginModule.java:127)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at javax.security.auth.login.LoginContext.invoke(Unknown Source)
	at javax.security.auth.login.LoginContext.access$000(Unknown Source)
	at javax.security.auth.login.LoginContext$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.login.LoginContext.invokePriv(Unknown Source)
	at javax.security.auth.login.LoginContext.login(Unknown Source)
...

Sendo que eu nem utilizo este tipo de altenticação, via properties.

Falando nisso já criei minha classe CNULoginModule e inclui o seu jar na pasta common\lib do jboss.
Ele nem chega a chamar minha classe CNULoginModule para altenticar.
Alguém sabe o pq?

D

rafaelvalerini você pode solucionar usando <application-policy name = “other”> ou criando o arquivo jboss-web.xml na pasta WEB-INF assim:

&lt;jboss-web&gt;
	&lt;security-domain&gt;java:/jaas/CNULogin&lt;/security-domain&gt;
&lt;/jboss-web&gt;
rodrigo_ctba

Vc. declarou o seu LoginModule dentro do login-config.xml do JBOSS?

Assim:

<application-policy name = "LoginModuleACME"> <authentication> <login-module code = "br.acme.security.principals.LoginModuleACME" flag = "required"/> </authentication> </application-policy>

G

rafaelvalerini, vc conseguiu resolver o problema? se sim, como? Estou passando por um problema parecido

meu login-config.xml

<application-policy name="MeuRealm"> <authentication> <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required"> <module-option name="dsJndiName">java:/MeuDatasource</module-option> <module-option name="principalsQuery">SELECT password FROM myuser WHERE username=?</module-option> <module-option name="rolesQuery">SELECT role, 'Roles' FROM myuser_roles WHERE username=?</module-option> <module-option name="hashAlgorithm">MD5</module-option> </login-module> </authentication> </application-policy>

e no jboss-web.xml

<?xml version="1.0" encoding="UTF-8"?> <jboss-web> <security-domain>java:/jaas/MeuRealm</security-domain> </jboss-web>

quando eu removo o jboss-web.xml do WEB-INF o erro

java.io.IOException: No properties file: users.properties or defaults: defaultUsers.properties found

é lançado, e quando eu adiciono o jboss-web.xml ao projeto simplesmente não sai nada no log e sempre sou redirecionado para a tela de erro de login.

jmag

Olá geraldo.vec,

Por favor coloque o seu login-config.xml completo, também jboss-web.xml e mais a estrutura das tabelas. Qual a versão exata do seu JBoss?

Com essas informações posso realizar os testes e dizer o que está ocorrendo.

Abs

G

jmag, obrigado pela ajuda, mas já consegui resolver o problema, modifiquei o nível de log do servidor para TRACE e consegui encontrar o problema, o servidor estava executando o processo de login corretamente, o meu problema era com o hash da senha armazenada no banco, eu utilizei a função MD5 do hibernate para fazer o hash da senha, só que o hibernate utilizou a codificação base16 para gerar o hash, já o JBoss estava utilizando a codificação base64, com isso os hash gerados eram sempre diferentes, por isso sempre me redirecionada para a tela de erro de login, adicionei o seguinte no login-config.xml

e resolveu o problema.

vlw

jmag

Legal Geraldo… o bom que fica um dica para quem passar pelo mesmo problema :smiley:

Qualquer coisa é só dizer :slight_smile:

Abs

silver00

Estou com um problema referente ao JAAS. Quando tento fazer o login, simplesmente não acontece nada. No trace log da erro de autenticação que não entendo.

Stacktrace
2013-04-23 10:39:55,597 DEBUG [org.apache.catalina.connector.CoyoteAdapter] (http-127.0.2.1-8080-5)  Requested cookie session id is 85A362CEC46B747DE78B4D4139578DE5
2013-04-23 10:39:55,597 DEBUG [org.apache.catalina.authenticator.AuthenticatorBase] (http-127.0.2.1-8080-5) Security checking request GET /CertificadoDigital-web/javax.faces.resource/images/ui-bg_glass_20_474747_1x400.png.xhtml
2013-04-23 10:39:55,598 DEBUG [org.apache.catalina.realm.RealmBase] (http-127.0.2.1-8080-5)   Checking constraint 'SecurityConstraint[Users]' against GET /javax.faces.resource/images/ui-bg_glass_20_474747_1x400.png.xhtml --> false
2013-04-23 10:39:55,598 DEBUG [org.apache.catalina.realm.RealmBase] (http-127.0.2.1-8080-5)   Checking constraint 'SecurityConstraint[Users]' against GET /javax.faces.resource/images/ui-bg_glass_20_474747_1x400.png.xhtml --> false
2013-04-23 10:39:55,598 DEBUG [org.apache.catalina.realm.RealmBase] (http-127.0.2.1-8080-5)   Checking constraint 'SecurityConstraint[Users]' against GET /javax.faces.resource/images/ui-bg_glass_20_474747_1x400.png.xhtml --> false
2013-04-23 10:39:55,598 DEBUG [org.apache.catalina.realm.RealmBase] (http-127.0.2.1-8080-5)   Checking constraint 'SecurityConstraint[Users]' against GET /javax.faces.resource/images/ui-bg_glass_20_474747_1x400.png.xhtml --> false
2013-04-23 10:39:55,598 DEBUG [org.apache.catalina.realm.RealmBase] (http-127.0.2.1-8080-5)   No applicable constraint located
2013-04-23 10:39:55,598 DEBUG [org.apache.catalina.authenticator.AuthenticatorBase] (http-127.0.2.1-8080-5)  Not subject to any constraint
2013-04-23 10:39:55,598 TRACE [org.apache.catalina.core.StandardWrapper] (http-127.0.2.1-8080-5)   Returning non-STM instance
2013-04-23 10:39:55,599 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) servletPath /javax.faces.resource/images/ui-bg_glass_20_474747_1x400.png.xhtml
2013-04-23 10:39:55,599 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) pathInfo null
2013-04-23 10:39:55,599 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) URL pattern of the FacesServlet executing the current request .xhtml
2013-04-23 10:39:55,599 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) URL pattern of the FacesServlet executing the current request .xhtml
2013-04-23 10:39:55,601 FINE  [javax.enterprise.resource.webcontainer.jsf.resource] (http-127.0.2.1-8080-5) Caching ResourceInfo: ResourceInfo{name='images/ui-bg_glass_20_474747_1x400.png', version='NONE', libraryName='primefaces-cruze', libraryVersion='null', localePrefix='NONE', path='META-INF/resources/primefaces-cruze/images/ui-bg_glass_20_474747_1x400.png', compressible='false', compressedPath=null}
2013-04-23 10:40:09,189 DEBUG [org.apache.catalina.connector.CoyoteAdapter] (http-127.0.2.1-8080-5)  Requested cookie session id is 85A362CEC46B747DE78B4D4139578DE5
2013-04-23 10:40:09,190 DEBUG [org.apache.catalina.authenticator.AuthenticatorBase] (http-127.0.2.1-8080-5) Security checking request POST /CertificadoDigital-web/pages/public/j_security_check
2013-04-23 10:40:09,190 DEBUG [org.apache.catalina.authenticator.FormAuthenticator] (http-127.0.2.1-8080-5) Authenticating username 'MPFontana'
2013-04-23 10:40:09,226 TRACE [org.apache.catalina.core.StandardWrapper] (http-127.0.2.1-8080-5)   Returning non-STM instance
2013-04-23 10:40:09,227 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) servletPath /pages/public/loginError.xhtml
2013-04-23 10:40:09,227 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) pathInfo null
2013-04-23 10:40:09,228 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) URL pattern of the FacesServlet executing the current request .xhtml
2013-04-23 10:40:09,228 FINE  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-127.0.2.1-8080-5) execute(com.sun.faces.context.FacesContextImpl@1492aff)
2013-04-23 10:40:09,228 FINE  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-127.0.2.1-8080-5) Entering RestoreViewPhase
2013-04-23 10:40:09,230 FINE  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-127.0.2.1-8080-5) New request: creating a view for /pages/public/loginError.xhtml
2013-04-23 10:40:09,230 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) URL pattern of the FacesServlet executing the current request .xhtml
2013-04-23 10:40:09,230 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) URL pattern of the FacesServlet executing the current request .xhtml
2013-04-23 10:40:09,230 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'javax.faces.ViewRoot'
2013-04-23 10:40:09,230 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created new view for /pages/public/loginError.xhtml
2013-04-23 10:40:09,231 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Locale for this view as determined by calculateLocale pt_BR
2013-04-23 10:40:09,231 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) RenderKitId for this view as determined by calculateRenderKitId HTML_BASIC
2013-04-23 10:40:09,232 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.factory] (http-127.0.2.1-8080-5) Resource-Url from external context: jndi:/localhost/CertificadoDigital-web/pages/public/loginError.xhtml
2013-04-23 10:40:09,232 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.factory] (http-127.0.2.1-8080-5) Creating Metadata Facelet for: jndi:/localhost/CertificadoDigital-web/pages/public/loginError.xhtml
2013-04-23 10:40:09,239 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Namespace Pushed : http://www.w3.org/1999/xhtml
2013-04-23 10:40:09,239 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Starting Unit: com.sun.faces.facelets.compiler.NamespaceUnit@4387f5 and adding it to parent: com.sun.faces.facelets.compiler.CompilationUnit@192f558
2013-04-23 10:40:09,239 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Namespace Pushed h: http://java.sun.com/jsf/html
2013-04-23 10:40:09,239 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Namespace Pushed f: http://java.sun.com/jsf/core
2013-04-23 10:40:09,239 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Namespace Pushed ui: http://java.sun.com/jsf/facelets
2013-04-23 10:40:09,239 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Namespace Pushed p: http://primefaces.org/ui
2013-04-23 10:40:09,240 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Finished Unit: com.sun.faces.facelets.compiler.NamespaceUnit@4387f5
2013-04-23 10:40:09,240 FINE  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-127.0.2.1-8080-5) Exiting RestoreViewPhase
2013-04-23 10:40:09,240 FINE  [javax.enterprise.resource.webcontainer.jsf.timing] (http-127.0.2.1-8080-5)  [TIMING] - [12ms] : Execution time for phase (including any PhaseListeners) -> RESTORE_VIEW 1
2013-04-23 10:40:09,240 FINE  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-127.0.2.1-8080-5) render(com.sun.faces.context.FacesContextImpl@1492aff)
2013-04-23 10:40:09,240 FINE  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-127.0.2.1-8080-5) Entering RenderResponsePhase
2013-04-23 10:40:09,241 FINE  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-127.0.2.1-8080-5) About to render view /pages/public/loginError.xhtml
2013-04-23 10:40:09,241 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) URL pattern of the FacesServlet executing the current request .xhtml
2013-04-23 10:40:09,241 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Building View: /pages/public/loginError.xhtml
2013-04-23 10:40:09,241 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.factory] (http-127.0.2.1-8080-5) Creating Facelet for: jndi:/localhost/CertificadoDigital-web/pages/public/loginError.xhtml
2013-04-23 10:40:09,243 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Starting Unit: TextUnit[0] and adding it to parent: com.sun.faces.facelets.compiler.CompilationUnit@7fcee1
2013-04-23 10:40:09,247 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Namespace Pushed : http://www.w3.org/1999/xhtml
2013-04-23 10:40:09,247 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Starting Unit: com.sun.faces.facelets.compiler.NamespaceUnit@19a1780 and adding it to parent: TextUnit[0]
2013-04-23 10:40:09,247 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Namespace Pushed h: http://java.sun.com/jsf/html
2013-04-23 10:40:09,247 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Namespace Pushed f: http://java.sun.com/jsf/core
2013-04-23 10:40:09,247 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Namespace Pushed ui: http://java.sun.com/jsf/facelets
2013-04-23 10:40:09,247 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Namespace Pushed p: http://primefaces.org/ui
2013-04-23 10:40:09,247 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Tag Pushed: /pages/public/loginError.xhtml @6,42 <html>
2013-04-23 10:40:09,248 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) /pages/public/loginError.xhtml @6,42 xmlns:h="http://java.sun.com/jsf/html" Namespace Bound to TagLibrary
2013-04-23 10:40:09,248 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) /pages/public/loginError.xhtml @6,42 xmlns:f="http://java.sun.com/jsf/core" Namespace Bound to TagLibrary
2013-04-23 10:40:09,248 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) /pages/public/loginError.xhtml @6,42 xmlns:ui="http://java.sun.com/jsf/facelets" Namespace Bound to TagLibrary
2013-04-23 10:40:09,248 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) /pages/public/loginError.xhtml @6,42 xmlns:p="http://primefaces.org/ui" Namespace Bound to TagLibrary
2013-04-23 10:40:09,248 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Starting Unit: TextUnit[0] and adding it to parent: com.sun.faces.facelets.compiler.NamespaceUnit@19a1780
2013-04-23 10:40:09,248 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Tag Pushed: /pages/public/loginError.xhtml @8,59 <ui:decorate>
2013-04-23 10:40:09,248 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Starting Unit: /pages/public/loginError.xhtml @8,59 <ui:decorate> and adding it to parent: TextUnit[0]
2013-04-23 10:40:09,249 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Starting Unit: TextUnit[0] and adding it to parent: /pages/public/loginError.xhtml @8,59 <ui:decorate>
2013-04-23 10:40:09,249 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Tag Pushed: /pages/public/loginError.xhtml @9,34 <ui:define>
2013-04-23 10:40:09,249 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Starting Unit: /pages/public/loginError.xhtml @9,34 <ui:define> and adding it to parent: TextUnit[0]
2013-04-23 10:40:09,249 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Starting Unit: TextUnit[0] and adding it to parent: /pages/public/loginError.xhtml @9,34 <ui:define>
2013-04-23 10:40:09,250 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Tag Pushed: /pages/public/loginError.xhtml @10,13 <p>
2013-04-23 10:40:09,250 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Finished Unit: TextUnit[0]
2013-04-23 10:40:09,250 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Finished Unit: /pages/public/loginError.xhtml @9,34 <ui:define>
2013-04-23 10:40:09,250 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Finished Unit: TextUnit[1]
2013-04-23 10:40:09,250 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.compiler] (http-127.0.2.1-8080-5) Finished Unit: /pages/public/loginError.xhtml @8,59 <ui:decorate>
2013-04-23 10:40:09,251 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.ui.decorate] (http-127.0.2.1-8080-5) /pages/public/loginError.xhtml @8,59 <ui:decorate> found Define[centro]
2013-04-23 10:40:09,252 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.factory] (http-127.0.2.1-8080-5) Resource-Url from external context: jndi:/localhost/CertificadoDigital-web/resources/template/default.xhtml
2013-04-23 10:40:09,252 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'javax.faces.Output'
2013-04-23 10:40:09,252 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http-127.0.2.1-8080-5) /resources/template/default.xhtml @7,13 <h:head> Component[-1454422182_5f886349] Created: javax.faces.component.UIOutput
2013-04-23 10:40:09,253 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'javax.faces.Output'
2013-04-23 10:40:09,253 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http-127.0.2.1-8080-5) /resources/template/default.xhtml @14,13 <h:body> Component[-1454422182_5f886363] Created: javax.faces.component.UIOutput
2013-04-23 10:40:09,253 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'org.primefaces.component.Layout'
2013-04-23 10:40:09,253 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'javax.faces.Output'
2013-04-23 10:40:09,253 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'javax.faces.ComponentResourceContainer'
2013-04-23 10:40:09,254 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'javax.faces.Output'
2013-04-23 10:40:09,254 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'javax.faces.Output'
2013-04-23 10:40:09,254 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'javax.faces.Output'
2013-04-23 10:40:09,254 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'javax.faces.Output'
2013-04-23 10:40:09,255 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'javax.faces.Output'
2013-04-23 10:40:09,255 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http-127.0.2.1-8080-5) /resources/template/default.xhtml @16,82 <p:layout> Component[-1454422182_5f886305] Created: org.primefaces.component.layout.Layout
2013-04-23 10:40:09,256 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'org.primefaces.component.LayoutUnit'
2013-04-23 10:40:09,256 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http-127.0.2.1-8080-5) /resources/template/header.xhtml @10,62 <p:layoutUnit> Component[-445138472_252c5a4a] Created: org.primefaces.component.layout.LayoutUnit
2013-04-23 10:40:09,257 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'javax.faces.HtmlGraphicImage'
2013-04-23 10:40:09,257 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http-127.0.2.1-8080-5) /resources/template/header.xhtml @11,103 <h:graphicImage> Component[-445138472_252c5a30] Created: javax.faces.component.html.HtmlGraphicImage
2013-04-23 10:40:09,257 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'org.primefaces.component.LayoutUnit'
2013-04-23 10:40:09,257 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http-127.0.2.1-8080-5) /resources/template/default.xhtml @24,58 <p:layoutUnit> Component[-1454422182_5f8863c8] Created: org.primefaces.component.layout.LayoutUnit
2013-04-23 10:40:09,257 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'javax.faces.HtmlForm'
2013-04-23 10:40:09,258 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http-127.0.2.1-8080-5) /resources/template/default.xhtml @26,33 <h:form> Component[-1454422182_5f8863f4] Created: javax.faces.component.html.HtmlForm
2013-04-23 10:40:09,258 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'org.primefaces.component.Menu'
2013-04-23 10:40:09,258 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http-127.0.2.1-8080-5) /resources/template/default.xhtml @27,58 <p:menu> Component[-1454422182_5f886396] Created: org.primefaces.component.menu.Menu
2013-04-23 10:40:09,258 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'org.primefaces.component.Submenu'
2013-04-23 10:40:09,259 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http-127.0.2.1-8080-5) /resources/template/default.xhtml @28,57 <p:submenu> Component[-1454422182_5f8863b0] Created: org.primefaces.component.submenu.Submenu
2013-04-23 10:40:09,259 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'org.primefaces.component.MenuItem'
2013-04-23 10:40:09,259 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http-127.0.2.1-8080-5) /resources/template/default.xhtml @29,124 <p:menuitem> Component[-1454422182_5f886242] Created: org.primefaces.component.menuitem.MenuItem
2013-04-23 10:40:09,259 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'org.primefaces.component.MenuItem'
2013-04-23 10:40:09,259 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http-127.0.2.1-8080-5) /resources/template/default.xhtml @30,115 <p:menuitem> Component[-1454422182_5f886255] Created: org.primefaces.component.menuitem.MenuItem
2013-04-23 10:40:09,260 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'org.primefaces.component.MenuItem'
2013-04-23 10:40:09,260 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http-127.0.2.1-8080-5) /resources/template/default.xhtml @31,142 <p:menuitem> Component[-1454422182_5f88625c] Created: org.primefaces.component.menuitem.MenuItem
2013-04-23 10:40:09,260 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Created component with component type of 'org.primefaces.component.LayoutUnit'
2013-04-23 10:40:09,260 FINE  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http-127.0.2.1-8080-5) /resources/template/default.xhtml @40,49 <p:layoutUnit> Component[-1454422182_5f88626f] Created: org.primefaces.component.layout.LayoutUnit
2013-04-23 10:40:09,261 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Rendering View: /pages/public/loginError.xhtml
2013-04-23 10:40:09,263 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) URL pattern of the FacesServlet executing the current request .xhtml
2013-04-23 10:40:09,266 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) Client State: total number of characters written: 1.292
2013-04-23 10:40:09,267 FINE  [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.2.1-8080-5) URL pattern of the FacesServlet executing the current request .xhtml
2013-04-23 10:40:09,267 FINE  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-127.0.2.1-8080-5) Exiting RenderResponsePhase
2013-04-23 10:40:09,267 FINE  [javax.enterprise.resource.webcontainer.jsf.timing] (http-127.0.2.1-8080-5)  [TIMING] - [27ms] : Execution time for phase (including any PhaseListeners) -> RENDER_RESPONSE 6
2013-04-23 10:40:09,267 DEBUG [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/CertificadoDigital-web].[Faces Servlet]] (http-127.0.2.1-8080-5)  Disabling the response for futher output
2013-04-23 10:40:09,267 DEBUG [org.apache.catalina.authenticator.AuthenticatorBase] (http-127.0.2.1-8080-5)  Failed authenticate() test ??/CertificadoDigital-web/pages/public/j_security_check
web.xml
<!-- Protected Areas -->    
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Users</web-resource-name>
            <url-pattern>/pages/private/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>USER</role-name>
        </auth-constraint>
    </security-constraint>
 
    <!-- Validation By Form -->
    <login-config>
        <auth-method>FORM</auth-method>
        <form-login-config>        
            <form-login-page>/pages/public/login.xhtml</form-login-page>
            <form-error-page>/pages/public/loginError.xhtml</form-error-page>
        </form-login-config>
    </login-config>
 
    <!-- Allowed Roles -->   
    <security-role>
        <role-name>USER</role-name>
    </security-role>    
 
    <!-- Filter to get the user name and work with it -->
    <filter>
        <filter-name>LoginFilter</filter-name>
        <filter-class>br.com.certificado.filter.LoginFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>LoginFilter</filter-name>
        <url-pattern>/pages/private/*</url-pattern>
    </filter-mapping>
jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
    <!-- Links with JBoss the Realm to use -->
    <security-domain>java:/jaas/LoginCertRealm</security-domain>
</jboss-web>
login-config.xml
<application-policy name="LoginCertRealm">
		<authentication>
			<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
				<module-option name="dsJndiName">java:/LoginCertDS</module-option>
				<module-option name="principalsQuery">select password from profile where username = ?</module-option>
				<module-option name="rolesQuery">select rolename, 'Roles' from user_roles where username = ?</module-option>
			</login-module>
		</authentication>
	</application-policy>

Realm datasource

<?xml version="1.0" encoding="UTF-8"?>
 
<datasource jta="false" jndi-name="java:/LoginCertDS" pool-name="LoginCertDS" enabled="true" use-ccm="false">
	<connection-url>jdbc:mysql://localhost:3306/ejbca</connection-url>
	<driver-class>com.mysql.jdbc.Driver</driver-class>
	<driver>mysql-connector-java-5.1.15.jar</driver>
	<security>
		<user-name>root</user-name>
		<password>root</password>
	</security>
	<validation>
		<validate-on-match>false</validate-on-match>
		<background-validation>false</background-validation>
	</validation>
	<statement>
		<share-prepared-statements>false</share-prepared-statements>
	</statement>
</datasource>
Ataxexe

Não ressussite um tópico e crie outro para discutir a mesma coisa.

http://www.guj.com.br/java/298400-jboss-5-as--jaas

Criado 11 de fevereiro de 2009
Ultima resposta 23 de abr. de 2013
Respostas 9
Participantes 7