final NamespaceContextSelector selector = componentView.getComponent().getNamespaceContextSelector();
final ClassLoader oldCl = SecurityActions.getContextClassLoader();
NamespaceContextSelector.pushCurrentSelector(selector);
try {
SecurityActions.setContextClassLoader(classLoader);
SecurityContext sc = null;
org.omg.CORBA_2_3.portable.OutputStream out;
try {
Object retVal;
if (!home && opName.equals("_get_handle")) {
retVal = new HandleImplIIOP(orb.object_to_string(_this_object()));
} else if (home && opName.equals("_get_homeHandle")) {
retVal = homeHandle;
} else if (home && opName.equals("_get_EJBMetaData")) {
retVal = ejbMetaData;
} else {
Transaction tx = null;
if (inboundTxCurrent != null)
tx = inboundTxCurrent.getCurrentTransaction();
if (tx != null) {
transactionManager.resume(tx);
}
try {
SimplePrincipal principal = null;
Object credential = null;
if (sasCurrent != null) {
final byte[] incomingName = sasCurrent.get_incoming_principal_name();
if ( incomingName != null && incomingName.length > 0) {
//we have an identity token, which is a trust based mechanism
if (incomingName.length > 0) {
String name = new String(incomingName, "UTF-8");
int domainIndex = name.indexOf('@');
if (domainIndex > 0)
name = name.substring(0, domainIndex);
principal = new SimplePrincipal(name);
//we don't have any real way to establish trust here
//we just use the SASCurrent as a credential, and a custom login
//module can make a decision for us.
credential = sasCurrent;
}
} else {
//the client has just sent a username and password
final byte[] username = sasCurrent.get_incoming_username();
final byte[] incomingPassword = sasCurrent.get_incoming_password();
if(username.length > 0) {
String name = new String(username, "UTF-8");
int domainIndex = name.indexOf('@');
if (domainIndex > 0) {
name = name.substring(0, domainIndex);
}
principal = new SimplePrincipal(name);
credential = new String(incomingPassword, "UTF-8").toCharArray();
}
}
if (securityDomain != null) {
sc = SecurityContextFactory.createSecurityContext(securityDomain);
sc.getUtil().createSubjectInfo(principal, credential, null);
}
}
final Object[] params = op.readParams((org.omg.CORBA_2_3.portable.InputStream) in);
if (!home && opName.equals("isIdentical") && params.length == 1) {