[Security & JAAS/JBoss] - Please, one Simple RoadMap for User Login on Client SWING an
by CarlosDelfino
Hi, I am New on JBoss Security, and new in English too!
Please, I need one simple Road Map for configure JAAS Kerberos Login on client and propagate to JBoss 4.0.4 with EJB 3.
In the Client I have sucess with Kerberos Login, but I need use LoginJNDIInitialContext or other method for Authenticate on JBoss server, and I not have how I send my Password for KerberosLoginModule on JBoss JAAS, I Try use the ClientLoginModule, but even so I need send the password too, but I only have Kerberos Information after Login process, like KerberosPrincipal and KerberosTiket and KerberosKey.
I dont know if I make wrong, I have read many papers foruns, like this, on Internet and not undestand i need make for this work.
This is my config-login.xml:
| </application-policy>
| <application-policy name="KerberosTest">
| <authentication>
| <login-module flag="required" code="org.jboss.security.ClientLoginModule">
| <module-option name="debug">true</module-option>
| </login-module>
| <login-module code="com.sun.security.auth.module.Krb5LoginModule" llag="required">
| <module-option name = "debug">true</module-option>
| </login-module>
| <login-module code="examples.jaaskeberos.loginmodule.MyLoginModule" flag="required">
| <module-option name="group.file">data/group.properties</module-option>
| <module-option name="debug">true</module-option>
| </login-module>
| </authentication>
| </application-policy>
|
This is my Client Code for get InitialContext on JBoss:
| props.put("java.naming.factory.initial", "org.jboss.security.jndi.JndiLoginInitialContextFactory");
| props.put(Context.SECURITY_PRINCIPAL, ((KerberosPrincipal)subject.getPrincipals(KerberosPrincipal.class).toArray()[0]).getName());
| // Here I need my Credencials, How I get?
| // props.put(Context.SECURITY_CREDENTIALS, "?????????????????");
| InitialContext ctx = new InitialContext(props);
| .....
| // here I get and use EJB3
|
this is the JBoss log:
| 2006-12-06 17:34:41,113 DEBUG [org.jboss.remoting.transport.socket.ServerThread] WAKEUP in SERVER THREAD
| 2006-12-06 17:34:41,114 DEBUG [org.jboss.remoting.transport.socket.ServerThread] beginning dorun
| 2006-12-06 17:34:42,216 INFO [examples.jaaskerberos.ejb.EJBSeguroStatefull] Inicializado
| 2006-12-06 17:34:42,217 INFO [examples.jaaskerberos.ejb.EJBSeguroStatefull] Context: null
| 2006-12-06 17:34:42,218 INFO [examples.jaaskerberos.ejb.EJBSeguroStatefull] PostConstruct
| 2006-12-06 17:34:42,218 INFO [examples.jaaskerberos.ejb.EJBSeguroStatefull] Context: org.jboss.ejb3.BaseSessionContext@626028
| 2006-12-06 17:34:42,219 INFO [STDOUT] Debug is true storeKey false useTicketCache false useKeyTab false doNotPrompt false ticketCache is null KeyTab is null refreshKrb5Config is false principal is null tryFirstPass is false useFirstPass is false storePass is false clearPass is false
| 2006-12-06 17:34:42,220 INFO [STDOUT] [Krb5LoginModule] user entered username: carlos.delfino(a)CARLOSDELFINO.COM.BR
| 2006-12-06 17:34:42,360 INFO [examples.jaaskeberos.loginmodule.MyLoginModule] /home/projetos/java/ferramentas/jboss-versions/jboss-4.0.5.GA/data/group.properties2006-12-06 2006-12-06 17:34:42,475 DEBUG [org.jboss.remoting.transport.socket.ServerThread] begin thread wait
|
and this is client erro msg:
| Exception in thread "main" javax.ejb.EJBAccessException: Authentication failure
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:319)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
| at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:190)
| at org.jboss.remoting.Client.invoke(Client.java:525)
| at org.jboss.remoting.Client.invoke(Client.java:488)
| at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:78)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateful.StatefulRemoteProxy.invoke(StatefulRemoteProxy.java:133)
| at $Proxy1.echoComSeguranca_1(Unknown Source)
| at examples.jaaskerberos.JaasAcn.testaUsoDeAutorizacaoComEJB3(JaasAcn.java:152)
| at examples.jaaskerberos.JaasAcn.main(JaasAcn.java:88)
| Caused by: javax.security.auth.login.LoginException: java.lang.IllegalArgumentException: EncryptionKey: Key bytes cannot be null!
| at sun.security.krb5.EncryptionKey.<init>(EncryptionKey.java:189)
| at sun.security.krb5.EncryptionKey.acquireSecretKeys(EncryptionKey.java:167)
| at com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Krb5LoginModule.java:626)
| at com.sun.security.auth.module.Krb5LoginModule.login(Krb5LoginModule.java:512)
| 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:585)
| at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
| at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
| at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
| at java.security.AccessController.doPrivileged(Native Method)
| at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
| at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
| at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)
| at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)
| at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)
| at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:319)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
|
| at javax.security.auth.login.LoginContext.invoke(LoginContext.java:872)
| at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
| at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
| at java.security.AccessController.doPrivileged(Native Method)
| at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
| at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
| at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)
| at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)
| at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)
| at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:319)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
|
Thanks very much!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991777#3991777
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991777
19 years, 4 months
[JBossWS] - J2ME/JBossws 1.0.3 / chunking disabled but still error
by MmarcoM
hi all,
i m fighting trying to have myJ2ME cdlient to communicate iwht my EJB3 Webservice..
i noticed posts about http chunking, so i have disabled http chunking by setting this in deploy/tomcat/server.xml
this is the interface of my WS
| /**
| * Copyright @ 2006
| * By Marco Mistroni
| * Session EJB test
| */
| package com.mm.j2me.ejb;
|
| import java.util.Date;
| import java.util.List;
|
| import javax.ejb.Remote;
| import javax.ejb.Stateless;
| import javax.jws.WebService;
| import javax.jws.WebMethod;
| import javax.jws.WebParam;
| import javax.jws.WebResult;
| import javax.jws.soap.SOAPBinding;
|
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
| import javax.persistence.Query;
|
| import org.jboss.annotation.ejb.RemoteBinding;
| //import org.jboss.ws.annotation.PortComponent;
|
| import com.mm.j2me.core.Agency;
| import com.mm.j2me.core.JobApplication;
| import com.mm.j2me.core.Opportunity;
| import com.mm.j2me.core.User;
| import com.mm.j2me.core.WSFacade;
|
| @WebService (name="WSRemoteSEI",
| serviceName="WSFacade",
| targetNamespace="http://org.jboss.ws/ejb3ws")
| @SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
| use=SOAPBinding.Use.LITERAL)
|
|
| @Stateless
| @Remote (WSFacade.class)
| @RemoteBinding( jndiBinding="/ejb3/WSRemoteSEI")
|
| public class TestFacade implements WSFacade{
|
| @PersistenceContext
| EntityManager em;
| public void deleteAgency(Agency agency) {
| // TODO Auto-generated method stub
| Query query = getQuery("findAgencyById");
| query.setParameter("id", agency.getId());
| Agency agencyToDelete = (Agency)query.getSingleResult();
| em.remove(agencyToDelete);
| }
|
| public void deleteJobApplication(JobApplication app) {
| Query query = getQuery("findJAById");
| query.setParameter("id", app.getId());
| JobApplication jaToDelete = (JobApplication)query.getSingleResult();
| em.remove(jaToDelete);
|
| }
|
| public void deleteOpportunity(Opportunity opp) {
| Query query = getQuery("findOpportunityById");
| query.setParameter("id", opp.getId());
| Opportunity oppToDelete = (Opportunity)query.getSingleResult();
| em.remove(oppToDelete);
|
| }
|
| public Agency[] getAllAgencies() {
| // TODO Auto-generated method stub
| Query query = getQuery("findAllAgencies");
| List<Agency> list = query.getResultList();
| Agency[] agencies = new Agency[list.size()];
| return (Agency[])(list.toArray(agencies));
| }
|
| public JobApplication[] getAllJobApplications() {
| return new JobApplication[]{};
| }
|
| public Opportunity[] getAllOpportunities() {
| //Query query = getQuery("findAllOpportunities");
| //return query.getResultList();
| return new Opportunity[]{};
| }
|
| public void insertAgency(Agency agency) {
| // TODO Auto-generated method stub
| em.persist(agency);
| }
|
| public void insertJobApplication(JobApplication app) {
| em.persist(app);
|
| }
|
| public void insertOpportunity(Opportunity opp) {
| em.persist(opp);
|
| }
|
|
|
| private Query getQuery(String name) {
| return em.createNamedQuery(name);
| }
|
|
| @WebMethod(action="urn:synchronizeAgency")
| public @WebResult(name="returnAgency")Agency[]
| synchronizeAgency(@WebParam(name="inAgency")Agency[] inAgency) {
| Agency[] agencies = new Agency[2];
| Agency ag = new AgencyEEjb();
| ag.setName("ag1");
| ag.setEmailAddress("test(a)email.com");
| ag.setJobHunter("fuckya");
| ag.setPhoneNumber("1234");
| ag.setSite("mysite");
| agencies[0] = ag;
| Agency ag2 = new AgencyEEjb();
| ag2.setName("ag2");
| ag2.setEmailAddress("t(a)email.com");
| ag2.setJobHunter("f222");
| ag2.setPhoneNumber("122222");
| ag2.setSite("mysite222");
| agencies[1] = ag2;
| return agencies;
| }
|
| @WebMethod(action="urn:synchronizeJobApplication")
| public @WebResult(name="returnJA")JobApplication[]
| synchronizeJobApplication( @WebParam(name="inJA")JobApplication[] inJA) {
| JobApplication[] jas = new JobApplication[2];
| JobApplication ja1 = new JobApplicationEEjb();
| ja1.setAgencyName("Pathway");
| ja1.setCompany("Sumitomo Bank");
| ja1.setDuration(6);
| ja1.setJobApplicationTitle("Tester");
| ja1.setLocation("Reading");
| ja1.setSalary("300/day");
| jas[0] = ja1;
| JobApplication ja2 = new JobApplicationEEjb();
| ja2.setAgencyName("Mann");
| ja2.setCompany("Lehman Brothers");
| ja2.setDuration(6);
| ja2.setJobApplicationTitle("Sw Engineer");
| ja2.setLocation("London");
| ja2.setSalary("400/day");
| jas[1] = ja2;
| return jas;
| }
|
|
| @WebMethod(action="urn:synchronizeOpportunity")
| public @WebResult(name="returnOpportunity")Opportunity[]
| synchronizeOpportunity(@WebParam(name="inOpp")Opportunity[] inOpp) {
| Opportunity[] opps = new Opportunity[2];
| Opportunity opps1 = new OpportunityEEjb();
| opps1.setAgencyName("IT People");
| opps1.setJobHunterName("Syed Ahmed");
| opps1.setOpportunityDetails("SW Engineer in London");
| opps1.setOpportunityDate(new Date().getTime());
| opps1.setOpportunityEmail("mm(a)tgmm.com");
| opps[0] = opps1;
| Opportunity opps2 = new OpportunityEEjb();
| opps2.setAgencyName("Computer People");
| opps2.setJobHunterName("Menachim Begin");
| opps2.setOpportunityDetails("SW Engineer in France");
| opps2.setOpportunityDate(new Date().getTime());
| opps2.setOpportunityEmail("mm(a)tgmm.com");
| opps[1] = opps2;
|
| return opps;
| }
|
| @WebMethod(action="urn:login")
| public void login(@WebParam(name="username")String user,
| @WebParam(name="password")String password) {
| System.err.println("----- loggging in.....");
|
| }
|
| // Original sample
| @WebMethod(action="urn:testWebServiceMethod")
| public @WebResult(name="returnAgency")Agency[]
| testWebServiceMethod( @WebParam(name="inAgency") Agency[] inAgency) {
|
| Agency[] agencies = new Agency[2];
| Agency ag = new AgencyEEjb();
| ag.setName("ag1");
| ag.setEmailAddress("test(a)email.com");
| ag.setJobHunter("fuckya");
| ag.setPhoneNumber("1234");
| ag.setSite("mysite");
| agencies[0] = ag;
| Agency ag2 = new AgencyEEjb();
| ag2.setName("ag2");
| ag2.setEmailAddress("t(a)email.com");
| ag2.setJobHunter("f222");
| ag2.setPhoneNumber("122222");
| ag2.setSite("mysite222");
| agencies[1] = ag2;
| return agencies;
| }
|
| public void storeAgency(Agency agency) {
| // TODO Auto-generated method stub
|
| }
|
| public void storeJobApplication(JobApplication ja) {
| // TODO Auto-generated method stub
|
| }
|
| public void storeOpportunity(Opportunity opp) {
| // TODO Auto-generated method stub
|
| }
| }
|
i am testing the login method (which returns void)
this is the response that my j2me client gets
| <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
| <env:Header/>
| <env:Body><ns1:loginResponse xmlns:ns1='http://org.jboss.ws/ejb3ws' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'/>
| </env:Body>
| </env:Envelope>
|
still, i am getting this exception from midp
AXRPcC EXception.
| javax.xml.rpc.JAXRPCException: java.rmi.MarshalException: (1)Missing end tag for Body or Envelope
| at com.sun.j2mews.xml.rpc.SOAPDecoder.decode(+243)
| at com.sun.j2mews.xml.rpc.OperationImpl.invoke(+90)
| at com.mm.j2me.ws.WSRemoteSEI_Stub.login(+48)
| at com.mm.j2me.midp.model.HTTPCommunicationHandler.createAccount(+36)
| at com.mm.j2me.midp.model.RemoteModelRequestHandler.createAccount(+16)
| at com.mm.j2me.midp.model.RemoteModelProxy.createAccount(+16)
| at com.mm.j2me.midp.model.ModelFacade.createAccount(+16)
| at com.mm.j2me.midp.ui.UIController$EventDispatcher.run(+277)
|
can anyone help pls? i have been stuck with this for 4 days....
thanks and regards
marco
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991773#3991773
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991773
19 years, 4 months
[Security & JAAS/JBoss] - Login encryption not working
by ewade
I have MD5 encrypted passwords in my database. I would like the login module to encrypt the plain text password before comparing to the database password. I have the following application policy set up in the login-config.xml file:
<application-policy name = "HsqlDbRealm">
<login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
<module-option name = "principal">sa</module-option>
<module-option name = "userName">sa</module-option>
<module-option name = "password"></module-option>
<module-option name="hashAlgorithm">MD5</module-option>
<module-option name ="hashEncoding">base64</module-option>
<module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=DefaultDS</module-option>
</login-module>
</application-policy>
But its not working. My login page is treating the password as plain text and not encoding it before comparison. What am I missing here?
(I am using JBoss 4.0.4 with Hibernate and Postgress 8.1.4.)
Thanks for the help!
Elise Wade
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991771#3991771
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991771
19 years, 4 months
[JBoss Seam] - Re: Seam configuration questions
by lightbulb432
I'm guessing those already-installed libs you mentioned would either be located in JBOSS/lib or JBOSS/server/lib and thus added to the classpath of appropriate deployments?
I've been having an issue understanding what exactly is on my classpath at any given time...if I'm looking for a given class, I'd like to do it from a centralized place rather than essentially "guessing" which JAR it's in, then looking through it, then making another guess as to whether that JAR is on the classpath (because there could be multiple versions of the same class deployed in one app, which probably happened with me because I added the myfaces classes on top of the JBoss built-in ones)
How can I do this in JBoss (see all classes currently on the classpath for a given deployment or application)? Is this something I can do from the jmx-console, or some very simple Java client I could write to interact with the app server that could tell me this?
I'd hope so, as this seems like a pretty useful or commonly-needed feature when developing on JBoss and troubleshooting problems with web or ejb apps...
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991770#3991770
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991770
19 years, 4 months