*/
public AS_ContextSec createASContextSec(
EjbIORConfigurationDescriptor iorDesc, String realmName)
throws IOException
{
AS_ContextSec asContext = null;
int target_supports = 0;
int target_requires = 0;
byte[] client_authentication_mechanism = {};
byte[] target_name = {} ;
String authMethod = null;
boolean authMethodRequired = false;
if(_logger.isLoggable(Level.FINE)){
_logger.log(Level.FINE, "IIOP: Creating AS_Context");
}
// If AS_ContextSec is not required to be generated in an IOR,
// then optimize the code by not generating and filling in fields that are
// irrelevant.
if (iorDesc != null) {
authMethod = iorDesc.getAuthenticationMethod();
authMethodRequired = iorDesc.isAuthMethodRequired();
}
if ((authMethod != null) &&
(authMethod.equalsIgnoreCase(EjbIORConfigurationDescriptor.NONE))) {
asContext = new AS_ContextSec((short)target_supports,
(short)target_requires, client_authentication_mechanism,
target_name);
return asContext;
}
/** Functionality for Realm Per App
* Try to get the realm from the descriptor, else fill in default
*/
/* if(_realm_name == null){// realm name should be populated at this point
if(iorDesc != null){
_realm_name = iorDesc.getRealmName();
}
if(_realm_name == null){
_realm_name = DEFAULT_REALM;
if(_logger.isLoggable(Level.FINE)){
_logger.log(Level.FINE, "IIOP:AS_Context: Realm Name = null,"
+ " setting default realm for logging in");
}
}
}*/
if(_logger.isLoggable(Level.FINE)){
_logger.log(Level.FINE, "IIOP:AS_Context: Realm Name for login = "+
realmName);
}
if (realmName == null) {
realmName = iorDesc.getRealmName();
}
if (realmName == null) {
realmName = DEFAULT_REALM;
}
byte[] _realm_name_bytes = realmName.getBytes();
target_name = GSSUtils.createExportedName(
GSSUtils.GSSUP_MECH_OID,
_realm_name_bytes);
target_supports = EstablishTrustInClient.value;
if (authMethodRequired){
target_requires = EstablishTrustInClient.value;
}
client_authentication_mechanism = GSSUtils.getMechanism();
asContext = new AS_ContextSec((short)target_supports,
(short)target_requires,
client_authentication_mechanism,
target_name);
return asContext;