[JBoss Portal] - Components in JBoss Portal 2.7.2
by thegman
Hi all,
I'm very new to JBoss Portal and JBoss generally, so I do apologise if this is actually documented somewhere.
I'm trying to work out what version of components are included in the JBoss Portal 2.7.2 bundle download.. without actually downloading it.
The reason I'm interested is because I already have v2.7.1 and it has that terrible WSRP "bug" when behind a firewall.
There's some info on the forums to upgrade to WS 3.0.4 GA... so I want to know if that's already included in v2.7.2 of Portal so I can just go with that rather than toying around trying to manually upgrade components.
Maybe upgrading individual components is easy but being 100% new to JBoss (even though I have a good deal of OAS 10g experience) I'm trying to figure how JBoss Portal hangs together.
I'm a Solaris sysadmin not a developer so many of the terms don't immediately mean much to me.
Can anyone please direct me to where this might be documented?
Thank you in advance.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4220511#4220511
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4220511
17 years, 1 month
[Security & JAAS/JBoss] - Re: sessioncontext getPrincipal returns empty string in 5.0.
by jannemaijanen
Hello!
I'm using a remote java client and here's the client side test code;
| Hashtable<String,String> jndiProps=new Hashtable<String, String>();
| jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| jndiProps.put(Context.PROVIDER_URL, "jnp://localhost:1099");
| jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
|
| InitialContext initialContext;
| try {
| SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
| securityClient.setSimple("jamai", "jamai1");
| securityClient.login();
| initialContext = new InitialContext(jndiProps);
|
| Object obj=initialContext.lookup("test/SecTestBean/remote");
| SecTest ops=(SecTest)PortableRemoteObject.narrow(obj, SecTest.class);
| String currentUser=ops.getCurrentUser("jamai");
| System.out.println(currentUser);
| } catch (Exception e) {
| e.printStackTrace();
| }
|
And then here's a basic login module used just for testing this case, it does not perform the actual authentication;
| package test.ejb;
|
| import java.security.Principal;
| import java.security.acl.Group;
| import java.util.Map;
|
| import javax.security.auth.Subject;
| import javax.security.auth.callback.Callback;
| import javax.security.auth.callback.CallbackHandler;
| import javax.security.auth.callback.NameCallback;
| import javax.security.auth.callback.PasswordCallback;
| import javax.security.auth.login.LoginException;
|
| import org.jboss.security.SimpleGroup;
| import org.jboss.security.SimplePrincipal;
| import org.jboss.security.auth.spi.AbstractServerLoginModule;
|
| public class BypassLogin extends AbstractServerLoginModule{
| private boolean debug;
| private Principal identity;
| private SimpleGroup userRoles;
| private SimpleGroup callerPrincipal;
| private String userName;
|
| @Override
| protected Principal getIdentity() {
| return identity;
| }
|
| @Override
| protected Group[] getRoleSets() throws LoginException {
| return new Group[] { userRoles, callerPrincipal };
| }
|
| /////////////////////////////
|
| public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
| super.initialize(subject,callbackHandler, sharedState, options);
| this.userRoles = new SimpleGroup( "Roles" );
| this.callerPrincipal=new SimpleGroup("CallerPrincipal");
| }
|
| /**
| * Handle the login. Remember to set the loginOk boolean when successful
| * @return true if login was successful
| */
| public boolean login() throws LoginException {
| String username = null;
| String password = null;
|
| if( identity == null ) {
| if( callbackHandler == null ) {
| throw new LoginException( "No callback handler for login");
| }
|
| NameCallback nc = new NameCallback("Name:", "guest");
| PasswordCallback pc = new PasswordCallback("Password:", false);
| Callback[] callbacks = {nc, pc};
|
| try {
| callbackHandler.handle(callbacks);
| username = nc.getName();
| if(username==null) throw new LoginException("User name is null.");
| char[] tmpPassword = pc.getPassword();
| if( tmpPassword != null ) {
| password = new String(tmpPassword);
| }
| }
| catch(LoginException e) {
| if(debug)System.out.println(e.getMessage());
| throw e;
| }
| catch ( Exception e ) {
| if(debug)e.printStackTrace();
| throw new LoginException( "Error in login; "+e.getMessage());
| }
|
| this.userName=username;
| }
|
| loginOk = true;
| return true;
| }
|
| private void authorize(String userName) throws LoginException {
| try {
| identity = createIdentity(userName);
| } catch (Exception e) {
| throw new LoginException("Error creating identity; "+e.getMessage());
| }
|
| callerPrincipal.addMember(new SimplePrincipal(userName));
| userRoles.addMember(new SimplePrincipal("delos"));
| }
|
| @Override
| public boolean commit() throws LoginException {
| authorize(userName);
| return true;
| }
| }
|
And then the simple server side bean;
| package test.ejb;
|
| import java.security.Principal;
|
| import javax.annotation.Resource;
| import javax.ejb.Remote;
| import javax.ejb.SessionContext;
| import javax.ejb.Stateless;
|
| @Stateless
| @org.jboss.ejb3.annotation.SecurityDomain(value="bypass")
| @Remote(SecTest.class)
| public class SecTestBean implements SecTest {
| @Resource
| private SessionContext ctx;
|
| public String getCurrentUser(String thoughtUserName) throws Exception {
| Principal principal=ctx.getCallerPrincipal();
| if(!thoughtUserName.equals(principal.getName())) throw new Exception("MISMATCHING CTX.PRINCIPAL USER; "+thoughtUserName+"!="+principal.getName());
| return principal.getName();
| }
| }
|
So i checked the situation at server side, and the principal is "" when the client first time is run, and also the credientals returned by SecurityAssociation are also null.
Maybe I have missed something in the login module development, because after succesfull login the principal and credientals exist correctly.
Br, Janne
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4220484#4220484
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4220484
17 years, 1 month