IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Frameworks Web Java Discussion :

JAAS avec JBoss 6 et EJB 3


Sujet :

Frameworks Web Java

  1. #1
    Nouveau membre du Club
    Inscrit en
    Juillet 2008
    Messages
    26
    Détails du profil
    Informations forums :
    Inscription : Juillet 2008
    Messages : 26
    Points : 25
    Points
    25
    Par défaut JAAS avec JBoss 6 et EJB 3
    Bonjour
    je suis entrain de développer une application JEE dont j'ai deployer des session et des service REst pour communiquer avec un client web et un client Android using spring android
    Bref tous fonctionne nickel
    j'ai vous entamer la phase de sécurisation de mon midelware
    alors j'ai choisi JAAS en se bassant sur ma base de donné où sont stocké mes role et mes login et pass
    j'ai ajouter ce qui il faut je pense
    dans le login-config.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    <application-policy name="e-procurment_domaine">
    <authentication>
    <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
    <module-option name = "dsJndiName">java:/BasepfeDS</module-option> 
    <module-option name="principalsQuery">SELECT pass FROM personne WHERE login=?</module-option>
    <module-option name="rolesQuery">SELECT disc,'Roles'  FROM personne  WHERE login=?</module-option>
    </login-module>
    </authentication>
    </application-policy>
    mon application.xml
    like :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    <?xml version="1.0" encoding="UTF-8"?>
    <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
      <display-name>e-procurment</display-name>
      <module>
        <connector>e-procurmentConnector.rar</connector>
      </module>
      <module>
        <web>
          <web-uri>e-procurmentWeb.war</web-uri>
          <context-root>e-procurmentWeb</context-root>
        </web>
      </module>
      <module>
        <ejb>e-procurment-EJB.jar</ejb>
      </module>
      <data-source>
    	<description>...</description>
     		<name>BasepfeDS</name>
     		<class-name>com.mysql.jdbc.Driver</class-name>
     		<url>jdbc:mysql://localhost:3306/basepfe</url>
     
     	</data-source></application>
    ma session à sécuriser et la suite :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    @SecurityDomain("e-procurment_domaine")
    @DeclareRoles({ "physique", "acheteur", "vendeur" })
    @RolesAllowed({ "physique", "acheteur", "vendeur" })
    // @PermitAll
    @Stateless
    @RemoteBinding(jndiBinding = "acheteurRemote")
    @LocalBinding(jndiBinding = "acheteurLocal")
    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
    public class AcheteurSession implements AcheteurRemote, AcheteurLocal {
    	@EJB(lookup = "daoGeneriqueRemote")
    	private DaoGeneriqueRemote daoGenerique;
    	private Logger log = Logger.getLogger(AcheteurSession.class);
    @RolesAllowed("physique")
    	@Override
    	public List<Acheteur> findAll() {
    		log.debug("fetching all Acheteur");
    		return daoGenerique.findWithNamedQuery("Acheteur.findAll");
    	}
    bon pour tester le tou j'ai écrit un j'unite test case
    qui est le suivant
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
     
    public void setUp() throws Exception {
     
     
    		try {securityClient =SecurityClientFactory.getSecurityClient();
    			Properties proprietes = new Properties();
    			proprietes.load(new FileInputStream("jndi.properties"));
    			InitialContext ctx = new InitialContext(proprietes);
    			acheteurRemote = (AcheteurRemote) ctx.lookup("acheteurRemote");
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    	}
    @Test
    	public void testFindALL() {
    		System.out.println("Debut  test de la méthode findALL");
     
    		CallbackHandler handler= null;
    		//WebAuthentication wa=new WebAuthentication();
    	//wa.login("zahrat", "zahrat");
    		//securityClient.setJAAS("other");
    		securityClient.setSimple("zahrat", "zahrat");
     
     
    		Acheteur acheteur = new Acheteur();
    		System.out.println("" + acheteurRemote.findAll().size());
     
    		// } catch (EJBAccessException ex) {
    		// System.out.println("Erreur attendue de type EJBAccessException: "
    		// + ex.getMessage());
     
    		// } catch (Exception ex) {
     
    		// ex.printStackTrace();
    		// fail("Exception pendant le test find ALL");
    		System.out.println("Fin  test find ALL");}
    bon a noter que lorsque j'ai tester avec la méthode JAAS avec les fichier propertie ça fonctionné
    en exécutant mon test
    j'ai la stack suivante

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    javax.ejb.EJBAccessException: Invalid User
    	at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:161)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:392)
    	at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
    	at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
    	at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
    	at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:898)
    	at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:791)
    	at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:744)
    	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:548)
    	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)
    	at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:216)
    	at org.jboss.remoting.Client.invoke(Client.java:1961)
    	at org.jboss.remoting.Client.invoke(Client.java:804)
    	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:77)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.async.impl.interceptor.AsynchronousClientInterceptor.invoke(AsynchronousClientInterceptor.java:143)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
    	at $Proxy12.invoke(Unknown Source)
    	at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:185)
    	at $Proxy11.findAll(Unknown Source)
    	at com.soutem.test.UtilsateurSessionBean.testFindALL(UtilsateurSessionBean.java:203)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    	at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:72)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:77)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.async.impl.interceptor.AsynchronousClientInterceptor.invoke(AsynchronousClientInterceptor.java:143)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
    	at $Proxy12.invoke(Unknown Source)
    	at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:185)
    	at $Proxy11.findAll(Unknown Source)
    	at com.soutem.test.UtilsateurSessionBean.testFindALL(UtilsateurSessionBean.java:203)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    	at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

    j'ai parcourue pa mal de thread mais je me suis pas arriver à résoudre , il parait que la raquette du login et passe ne parvient pas à une résultat ... est ce que cette requette peut avoir directement un accès à la base ?
    sinon avez vous d'idée ?
    merci

  2. #2
    Nouveau membre du Club
    Inscrit en
    Juillet 2008
    Messages
    26
    Détails du profil
    Informations forums :
    Inscription : Juillet 2008
    Messages : 26
    Points : 25
    Points
    25
    Par défaut
    it works now great jaas
    c'est un conflit d'annotation et de config car j'ai suivie plusieure documentation
    la meilleur c'es celle de JBOSS ici http://docs.jboss.org/jbosssecurity/...verLoginModule
    je peut fournir de l'aide pour celui qui demande

  3. #3
    Membre du Club
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2011
    Messages
    63
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Septembre 2011
    Messages : 63
    Points : 55
    Points
    55
    Par défaut
    Salut ahmed,

    Je viens de tomber sur ton post.J'ai exactement le même probléme que toi.Quand j'utilise le DatabaseModule pour authentifier les utilisateurs à partir de ma base de données.Voila la TRACE :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
     
    javax.ejb.EJBAccessException: Invalid User
    	at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:161)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:392)
    	at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
    	at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
    	at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
    	at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:967)
    	at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:791)
    	at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:744)
    	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:548)
    	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)
    	at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:218)
    	at org.jboss.remoting.Client.invoke(Client.java:2070)
    	at org.jboss.remoting.Client.invoke(Client.java:879)
    	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:77)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.async.impl.interceptor.AsynchronousClientInterceptor.invoke(AsynchronousClientInterceptor.java:143)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
    	at $Proxy4.invoke(Unknown Source)
    	at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:185)
    	at $Proxy3.ajouter(Unknown Source)
    	at com.mailer.tests.GererUtilisateurTest.testAjoutUtilisateur(GererUtilisateurTest.java:60)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:616)
    	at junit.framework.TestCase.runTest(TestCase.java:168)
    	at junit.framework.TestCase.runBare(TestCase.java:134)
    	at junit.framework.TestResult$1.protect(TestResult.java:110)
    	at junit.framework.TestResult.runProtected(TestResult.java:128)
    	at junit.framework.TestResult.run(TestResult.java:113)
    	at junit.framework.TestCase.run(TestCase.java:124)
    	at junit.framework.TestSuite.runTest(TestSuite.java:243)
    	at junit.framework.TestSuite.run(TestSuite.java:238)
    	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:72)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:77)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.ejb3.async.impl.interceptor.AsynchronousClientInterceptor.invoke(AsynchronousClientInterceptor.java:143)
    	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    	at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
    	at $Proxy4.invoke(Unknown Source)
    	at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:185)
    	at $Proxy3.ajouter(Unknown Source)
    	at com.mailer.tests.GererUtilisateurTest.testAjoutUtilisateur(GererUtilisateurTest.java:60)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:616)
    	at junit.framework.TestCase.runTest(TestCase.java:168)
    	at junit.framework.TestCase.runBare(TestCase.java:134)
    	at junit.framework.TestResult$1.protect(TestResult.java:110)
    	at junit.framework.TestResult.runProtected(TestResult.java:128)
    	at junit.framework.TestResult.run(TestResult.java:113)
    	at junit.framework.TestCase.run(TestCase.java:124)
    	at junit.framework.TestSuite.runTest(TestSuite.java:243)
    	at junit.framework.TestSuite.run(TestSuite.java:238)
    	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    Voila le config-login.xml :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
     
      <application-policy name="Messagerie_domaine_DB">
    <authentication>
    <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
    <module-option name="dsJndiName"> java:/MySqlDS </module-option>
    <module-option name="principalsQuery"> select password from
    utilisateur where login=?
    </module-option>
    <module-option name="rolesQuery"> select type, ’Roles’ from
    utilisateur where login=?
    </module-option>
    </login-module>
    <login-module code="org.jboss.security.ClientLoginModule" flag="required" ></login-module>
    </authentication>
    </application-policy>
    </policy>

    je définis la stratégie d'authentification selon le type d'utilisateur:

Discussions similaires

  1. Local lookup sur EJB avec JBoss 7.1
    Par Shinosha dans le forum Wildfly/JBoss
    Réponses: 0
    Dernier message: 22/07/2012, 15h13
  2. Réponses: 1
    Dernier message: 21/12/2011, 10h18
  3. Interception d'EJB avec JBoss
    Par dr-Padbol dans le forum Wildfly/JBoss
    Réponses: 0
    Dernier message: 10/03/2011, 03h31
  4. [EJB3] Cours sur les EJB 3, mise en oeuve avec JBoss AS 4
    Par mmathieu dans le forum Java EE
    Réponses: 0
    Dernier message: 27/08/2009, 14h22
  5. Probleme de JAAS avec JBoss
    Par amine1980 dans le forum Wildfly/JBoss
    Réponses: 1
    Dernier message: 17/02/2007, 19h47

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo