|
|
セキュリティをインプリメントする CORBA アプリケーション
ここでは、次の内容について説明します。
ブートストラップ処理メカニズムの使用
注記 このメカニズムは、BEA CORBA クライアント・アプリケーションで使用します。
BEA Tuxedo CORBA 環境の Bootstrap オブジェクトは機能拡張されており、指定した IIOP リスナ/ハンドラに対するすべての接続を保護するように指定できます。Bootstrap オブジェクトは、IIOP リスナ/ハンドラの場所を指定する際に使用する corbaloc
および corbalocs
の URL (Uniform Resource Locator) アドレス形式をサポートしています。提供されるセキュリティのタイプは、IIOP リスナ/ハンドラの場所の指定に使用する URL の形式によって異なります。
ホストとポートのアドレス形式の場合、URL アドレス形式を使用して IIOP リスナ/ハンドラの場所を指定しますが、ブートストラップ処理プロセスの動作は異なります。corbaloc
または corbalocs
URL アドレス形式を使用する場合、IIOP リスナ/ハンドラへの初期接続は、以下のいずれかに分かれます。
Tobj::PrincipalAuthenticator::logon
メソッドまたは SecurityLevel2::PrincipalAuthenticator::authenticate
メソッドのいずれかによるパスワード認証を使用します。Tobj_Bootstrap::resolve_initial_references
メソッドを呼び出します。corbalocs
URL アドレス形式を使用すると、最低限、プリンシパルと IIOP リスナ/ハンドラの間の接続の整合性を保護するために SSL プロトコルが使用されます。
表 10-1 では、2 つの URL アドレス形式の違いを説明します。
corbaloc
および corbalocs
URL アドレス形式は、TCP/IP とドメイン・ネーム・システム (DNS) の両方の環境で簡単に操作できる文字列化されたオブジェクト・リファレンスを提供します。corbaloc
および corbalocs
URL アドレス形式には、DNS スタイルのホスト名または IP アドレスおよびポートが含まれます。
URL アドレス形式は、インターオペラブル・ネーミング・サービスの一部として Object Management Group (OMG) によって適用されたオブジェクト URL の定義に基づいて、その定義を拡張します。BEA Tuxedo ソフトウェアは、WebLogic Enterprise 製品の旧リリースの機能をサポートすることに加えて、セキュリティ保護された HTTP の URL に従ってモデル化された安全な形式をサポートするために、OMG インターオペラブル・ネーミング・サービスで記述された URL 形式も拡張します。
リスト 10-1 には、新しい URL アドレス形式の例があります。
リスト 10-1 corbaloc および corbalocs URL アドレス形式の例
corbaloc://555xyz.com:1024,corbaloc://555backup.com:1022,
corbaloc://555last.com:1999
corbalocs://555xyz.com:1024,(corbalocs://555backup.com:1022|corbalocs://555last.com:1999)
corbaloc://555xyz.com:1111
corbalocs://24.128.122.32:1011, corbalocs://24.128.122.34
BEA Tuxedo 製品は、異なるスキームの複数の URL の列挙をサポートする構文を拡張し、OMG インターオペラブル・ネーミング・サービスで記述した URL 構文の機能を向上しています。リスト 10-2 に、複数の URL を指定する例を示します。
リスト 10-2 複数の URL アドレス形式の指定の例
corba
locs://555xyz.com:1024,corbaloc://555xyz.com:1111
corbalocs://ctxobj.com:3434,corbalocs://mthd.com:3434,corbaloc://force.com:1111
リスト 10-2 の例では、パーサは、URL corbaloc://force.com:1111
に達すると、安全な接続を試行しなかったものとして内部状態をリセットし、保護されていない接続を試行します。これは、クライアント・アプリケーションが Credential オブジェクトで SSL パラメータを設定していない場合に起こります。
以下の節では、Bootstrap オブジェクトの異なるアドレス形式を使用した場合の動作を説明します。
ホストとポートのアドレス形式の使用
CORBA クライアント・アプリケーションが、Bootstrap オブジェクトのホストとポートのアドレス形式を使用する場合、Bootstrap オブジェクトのコンストラクタ・メソッドは、指定したホスト名およびポート番号を基にオブジェクト・リファレンスを作成します。IIOP リスナ/ハンドラに対する呼び出しは、SSL プロトコルによる保護なしに行われます。
クライアント・アプリケーションは、パスワード認証による認証も実行できます。ただし、ブートストラップ処理は非保護および非検証リンクで実行されるので、すべての接続は、以下のセキュリティ攻撃に対して脆弱です。
注記 IIOP リスナ/ハンドラが SSL プロトコル用にコンフィギュレーションされ、Bootstrap オブジェクトのホストとポートのアドレス形式が使用されている場合、指定した CORBA オブジェクトに対する呼び出しによって INVALID_DOMAIN
例外が発生します。
corbaloc URL アドレス形式の使用
デフォルトでは、corbaloc
URL アドレス形式およびパスワード認証を使用する場合に、IIOP リスナ/ハンドラに対する呼び出しは保護されていません。したがって、すべての通信は、以下のセキュリティ攻撃に対して脆弱です。
corbaloc
URL アドレス形式を使用する際に、SecurityLevel2::PrincipalAuthenticator::authenticate()
メソッドを使用して、証明書による認証を使用するように指定し、Credentials オブジェクトの invocation_methods_required
メソッドを呼び出して、ブートストラップ処理を保護できます。
注記 IIOP リスナ/ハンドラが SSL プロトコル用にコンフィギュレーションされているものの、証明書による認証用にコンフィギュレーションされておらず、corbaloc
URL アドレス形式が使用されている場合、指定した CORBA オブジェクトに対する呼び出しによって INVALID_DOMAIN
例外が発生します。
既存の CORBA アプリケーションを、ホストとポートのアドレス形式ではなく corbaloc
URL 形式に移行することをお勧めします。
corbalocs URL アドレス形式の使用
corbalocs
URL アドレス形式は、プリンシパルと IIOP リスナ/ハンドラの間の通信を保護する場合に推奨される形式です。corbalocs
URL アドレス形式は、corbaloc
URL アドレス形式とほぼ同じように機能しますが、使用する認証のタイプに関係なく、IIOP リスナ/ハンドラまたは CORBA C++ ORB を使用した通信を保護するために SSL プロトコルを使用する点が異なります。
デフォルトを corbalocs
URL アドレス形式で使用する場合、通信は、サービス拒否攻撃に対してのみ脆弱です。SSL プロトコルおよび証明書による認証を使用すると、スニッファ、改ざん、リプレイ攻撃を防ぐことができます。さらに、デジタル証明書で指定したホストの検証によって、介在者の攻撃も防ぐことができます。
corbalocs
URL アドレス形式を使用するには、SSL プロトコルの使用を有効にするように IIOP リスナ/ハンドラまたは CORBA C++ ORB をコンフィギュレーションする必要があります。IIOP リスナ/ハンドラまたは CORBA C++ ORB を SSL プロトコル用にコンフィギュレーションする際の詳細については、SSL プロトコルのコンフィギュレーションを参照してください。
パスワード認証の使用
ここでは、CORBA アプリケーションでのパスワード認証のインプリメントについて説明します。
Security サンプル・アプリケーション
Security サンプル・アプリケーションでは、パスワード認証を使用します。Security サンプル・アプリケーションでは、アプリケーションを使用している学生が固有の ID とパスワードを持っている必要があります。Security サンプル・アプリケーションは、以下のように動作します。
Registrar
オブジェクトの
get_student_details()
メソッドをインプリメントし、学生に関する情報
を返します。ユーザが認証され、ログオンが完了すると、
get_student_details()
メソッドは、データベース内の学生の情報にアク
セスし、クライアントのログオン・メソッドが必要とする学生の情報を取得
します。
図 10-1 では、Security サンプル・アプリケーションのしくみを示します。
図10-1 Security サンプル・アプリケーション
Security サンプル・アプリケーションのソース・ファイルは、BEA Tuxedo ソフトウェアの \samples
\corba
\university
ディレクトリにあります。Security サンプル・アプリケーションの作成と実行の詳細については、『BEA Tuxedo CORBA University サンプル・アプリケーション』を参照してください。
クライアント・アプリケーションの記述
パスワード認証を使用する場合、以下を実行するクライアント・アプリケーション・コードを記述します。
corbaloc
URL アドレス形式、または corbalocs
URL ア
ドレス形式を使用できます。
Tobj::TuxedoSecurity
を使用した SecurityLevel2::PrincipalAuthenticator::authenticate()
Tobj::TuxedoSecurity
を使用した SecurityLevel2.PrincipalAuthenticator.authenticate()
Tobj::PrincipalAuthenticator::logon()
Tobj.PrincipalAuthenticator.logon()
SecurityLevel2::PrincipalAuthenticator
インターフェイスは、CORBA サービス・セキュリティ・サービス仕様で定義されます。このインターフェイスには、プリンシパルの認証に使用する 2 つのメソッドがあります。メソッドが 2 つあるのは、プリンシパルの認証では複数の手順を必要とする可能性があるからです。authenticate()
メソッドでは、呼び出し側は、認証を行い、必要に応じてこのセッションのプリンシパルの属性を選択できます。
CORBA 環境は、BEA Texudo 製品の ATMI 環境にあるものと同様のセキュリティをサポートする機能で PrincipalAuthenticator オブジェクトを拡張します。拡張機能は、Tobj::PrincipalAuthenticator
インターフェイスによって提供されます。
Tobj::PrincipalAuthenticator
インターフェイス用に定義されたメソッドは、同等の CORBA 定義のインターフェイスの特化および単純化した形式を提供します。CORBA アプリケーションを開発する場合、CORBA 定義の拡張か BEA Tuxedo 拡張のいずれかを使用できます。
Tobj::PrincipalAuthenticator
インターフェイスは、SecurityLevel2::PrincipalAuthenticator
インターフェイスと同じ機能を提供します。ただし、SecurityLevel2::PrincipalAuthenticator::authenticate()
メソッドとは異なり、Tobj::PrincipalAuthenticator
インターフェイスの logon()
メソッドは、Credentials オブジェクトを返しません。結果として、複数のプリンシパル ID を使用する CORBA アプリケーションでは、ログオンの結果として Credentials オブジェクトを取得する logon()
メソッドの直後に Current::get_credentials()
メソッドを呼び出す必要があります。ログオン・メソッドの直後の Credentials オブジェクトの取得は、シリアル化されたアクセスで保護する必要があります。
注記 ログオンの一部として指定したユーザ・データには、NULL を含めることはできません。
次の節には、パスワード認証のインプリメントを示す C++ および Java のコード例があります。Visual Basic のコード例については、オートメーション・セキュリティ・リファレンスを参照してください。
SecurityLevel2::PrincipalAuthenticator::authenticate() メソッドを使用する C++ コード例
リスト 10-3 には、SecurityLevel2::PrincipalAuthenticator::authenticate()
メソッドを使用してパスワード認証を実行する C++ コード例があります。
リスト 10-3 SecurityLevel2::PrincipalAuthenticator::authenticate() メソッドを使用する C++ クライアント・アプリケーション
...
(orb,
//Bootstrap オブジェクトを作成
Tobj_Bootstrap* bootstrap = new Tobj_Bootstrap
corbalocs://sling.com:2143);
//SecurityCurrent オブジェクトを取得
CORBA::Object_var var_security_current_oref =
bootstrap.resolve_initial_references("SecurityCurrent");
SecurityLevel2::Current_var var_security_current_ref =
SecurityLevel2::Current::_narrow(var_security_current_oref.in());
//PrincipalAuthenticator を取得
SecurityLevel2::PrincipalAuthenticator_var var_principal_authenticator =
var_security_current_oref->principal_authenticator();
const char * user_name = "john"
const char * client_name = "university";
char system_password[31] = {'\0'};
char user_password[31] = {'\0'};
Tobj::PrincipalAuthenticator_ptr var_bea_principal_authenticator =
Tobj::PrincipalAuthenticator::_narrow(var_bea_principal_authenticator.in());
//セキュリティ・レベルを決定
Tobj::AuthType auth_type = var_bea_principal_authenticator->get_auth_type();
switch (auth_type)
{
case Tobj::TOBJ_NOAUTH;
break;
case Tobj::TOBJ_SYSAUTH
strcpy(system_password, "sys_pw");
case Tobj::TOBJ_APPAUTH
strcpy(system_password, "sys_pw");
strcpy(user_password, "john_pw");
break;
}
if (auth_type != Tobj::TOBJ_NOAUTH)
{
SecurityLevel2::Credentials_var creds;
Security::Opaque_var auth_data;
Security::AttributeList_var privileges;
Security::Opaque_var cont_data;
Security::Opaque_var auth_spec_data;
var_bea_principalauthenticator->build_auth_data(user_name,
client_name,
system_password,
user_password,
NULL,
auth_data,
privileges);
Security::AuthenticationStatus status =
var_bea_principalauthenticator->authenticate(
Tobj::TuxedoSecurity,
user_name,
auth_data,
privileges,
creds,
cont_data, auth_spec_data);
if (status != Security::SecAuthSuccess)
{
//認証に失敗
return;
}
}
//アプリケーションに進む
...
SecurityLevel2.PrincipalAuthenticator.authenticate() メソッドを使用する Java クライアント・アプリケーション
リスト 10-4 には、SecurityLevel2.PrincipalAuthenticator.authenticate()
メソッドを使用してパスワード認証を実行する Java コード例があります。
リスト 10-4 SecurityLevel2.PrincipalAuthenticator.authenticate() メソッドを使用する Java クライアント・アプリケーション
...
//Bootstrap オブジェクトを作成
Tobj_Bootstrap bs =
new Tobj_Bootstrap(orb, corbalocs://sling.com:2143);
//SecurityCurrent オブジェクトを取得
org.omg.CORBA.Object secCurObj =
bs.resolve_initial_references( "SecurityCurrent" );
org.omg.SecurityLevel2.Current secCur2Obj =
org.omg.SecurityLevel2.CurrentHelper.narrow(secCurObj);
//Principal Authenticator を取得
org.omg.Security.PrincipalAuthenticator princAuth =
secCur2Obj.principal_authenticator();
com.beasys.Tobj.PrincipalAuthenticator auth =
Tobj.PrincipalAuthenticatorHelper.narrow(princAuth);
//認証タイプを取得
com.beasys.Tobj.AuthType authType = auth.get_auth_type();
//引数を初期化
String userName = "John";
String clientName = "Teller";
String systemPassword = null;
String userPassword = null;
byte[] userData = new byte[0];
//要求されたセキュリティ・レベルに従って引数を準備
switch(authType.value())
{
case com.beasys.Tobj.AuthType._TPNOAUTH:
break;
case com.beasys.Tobj.AuthType._TPSYSAUTH:
systemPassword = "sys_pw";
break;
case com.beasys.Tobj.AuthType._TPAPPAUTH:
systemPassword = "sys_pw";
userPassword = "john_pw";
break;
}
//セキュリティ・データを構築
org.omg.Security.OpaqueHolder auth_data =
new org.omg.Security.OpaqueHolder();
org.omg.Security.AttributeListHolder privs =
new Security.AttributeListHolder();
auth.build_auth_data(userNname, clientName, systemPassword,
userPassword, userData, authData,
privs);
//ユーザを認証
org.omg.SecurityLevel2.CredentialsHolder creds =
new org.omg.SecurityLevel2.CredentialHolder();
org.omg.Security.OpaqueHolder cont_data =
new org.omg.Security.OpaqueHolder();
org.omg.Security.OpaqueHolder auth_spec_data =
new org.omg.Security.OpaqueHolder();
org.omg.Security.AuthenticationStatus status =
auth.authenticate(com.beasys.Tobj.TuxedoSecurity.value,
0, userName, auth_data.value(),
privs.value(), creds, cont_data,
auth_spec_data);
if (status != AuthenticatoinStatus.SecAuthSuccess)
System.exit(1);
}
...
Tobj::PrincipalAuthenticator::logon() メソッドを使用する C++ コード例
リスト 10-5 には、Tobj::PrincipalAuthenticator::logon()
メソッドを使用してパスワード認証を実行する C++ コード例があります。
リスト 10-5 Tobj::PrincipalAuthenticator::logon() メソッドを使用する C++ クライアント・アプリケーション
...
CORBA::Object_var var_security_current_oref =
bootstrap.resolve_initial_references("SecurityCurrent");
SecurityLevel2::Current_var var_security_current_ref =
SecurityLevel2::Current::_narrow(var_security_current_oref.in());
//PrincipalAuthenticator を取得
SecurityLevel2::PrincipalAuthenticator_var var_principal_authenticator_oref =
var_security_current_oref->principal_authenticator();
//PrincipalAuthenticator をナロー変換
Tobj::PrincipalAuthenticator_var var_bea_principal_authenticator =
Tobj::PrincipalAuthenticator::_narrow
var_principal_authenticator_oref.in());
const char * user_name = "john"
const char * client_name = "university";
char system_password[31] = {'\0'};
char user_password[31] = {'\0'};
//セキュリティ・レベルを決定
Tobj::AuthType auth_type = var_bea_principal_authenticator->get_auth_type();
switch (auth_type)
{
case Tobj::TOBJ_NOAUTH;
break;
case Tobj::TOBJ_SYSAUTH
strcpy(system_password, "sys_pw");
case Tobj::TOBJ_APPAUTH
strcpy(system_password, "sys_pw");
strcpy(user_password, "john_pw");
break;
}
if (auth_type != Tobj::TOBJ_NOAUTH)
{
SecurityLevel2::Credentials_var creds;
Security::Opaque_var auth_data;
Security::AttributeList_var privileges;
Security::Opaque_var cont_data;
Security::Opaque_var auth_spec_data;
//セキュリティ・レベルを決定
Tobj::AuthType auth_type = var_bea_principal_authenticator->get_auth_type();
Security::AuthenticationStatus status = var_bea_principal_authenticator->logon(
user_name,
client_name,
system_password,
user_password,
0);
if (status != Security::SecAuthSuccess)
{
//認証に失敗
return;
}
}//アプリケーションに進む
//ログオフ
...
try
{
logoff();
}...
Tobj.PrincipalAuthenticator.logon() メソッドを使用する Java クライアント・アプリケーション
リスト 10-6 には、Tobj.PrincipalAuthenticator.logon()
メソッドを使用してパスワード認証を実行する Java コード例があります。
リスト 10-6 Tobj.PrincipalAuthenticator.logon() メソッドを使用する Java クライアント・アプリケーション
...
//Bootstrap オブジェクトを作成
Tobj_Bootstrap bs =
new Tobj_Bootstrap(orb, corbaloc://sling.com;2143);
//SecurityCurrent オブジェクトを取得
org.omg.CORBA.Object secCurObj =
bs.resolve_initial_references( "SecurityCurrent" );
org.omg.SecurityLevel2.Current secCur2Obj =
org.omg.SecurityLevel2.CurrentHelper.narrow(secCurObj);
//Principal Authenticator を取得
org.omg.Security.PrincipalAuthenticator princAuth =
secCur2Obj.principal_authenticator();
com.beasys.Tobj.PrincipalAuthenticator auth =
Tobj.PrincipalAuthenticatorHelper.narrow(princAuth);
//認証タイプを取得
com.beasys.Tobj.AuthType authType = auth.get_auth_type();
//引数を初期化
String userName = "John";
String clientName = "Teller";
String systemPassword = null;
String userPassword = null;
byte[] userData = new byte[0];
//要求されたセキュリティ・レベルに従って引数を準備
switch(authType.value())
{
case com.beasys.Tobj.AuthType._TPNOAUTH:
break;
case com.beasys.Tobj.AuthType._TPSYSAUTH:
systemPassword = "sys_pw";
break;
case com.beasys.Tobj.AuthType._TPAPPAUTH:
systemPassword = "sys_pw";
userPassword = "john_pw";
break;
}
//Tuxedo 型の認証
org.omg.Security.AuthenticationStatus status =
auth.logon(userName, clientName, systemPassword,
userPassword, userData);
...
//アプリケーションに進む
//ログオフ
try
{auth.logoff();
}...
証明書による認証の使用
ここでは、CORBA アプリケーションでの証明書による認証のインプリメントについて説明します。
Secure Simpapp サンプル・アプリケーション
Secure Simpapp サンプル・アプリケーションは、既存の Simpapp サンプル・アプリケーションを使用し、SSL プロトコルおよび証明書による認証で保護された通信をサポートするようにコードおよびコンフィギュレーション・ファイルを変更します。
Secure Simpapp サンプル・アプリケーションのサーバ・アプリケーションは、以下の 2 つのメソッドを持つ CORBA オブジェクトのインプリメンテーションを提供します。
upper
メソッドは、クライアント・アプリケーションから文字列を受け取り、その文字列を大文字に変換します。 lower
メソッドは、クライアント・アプリケーションから文字列を受け取り、その文字列を小文字に変換します。Simpapp サンプル・アプリケーションは、証明書による認証と SSL プロトコルをサポートするために以下のように変更されました。
UBBCONFIG
ファイルの ISL
セクションで、IIOP リスナ/ハンドラに対して SSL プロトコルをコンフィギュレーションするために、ISL コマンドの -a
、-S
、-z
、および -Z
オプションが指定されています。UBBCONFIG
ファイルの ISL
セクションでは、IIOP リスナ/ハンドラに対する証明資料を指定するために、SEC_PRINCIPAL_NAME
、SEC_PRINCIPAL_LOCATION
、および SEC_PRINCIPAL_PASSVAR
パラメータが定義されています。corbalocs
URL アドレス形式を使用します。SecurityLevel2::PrincipalAuthenticator
インターフェイスの authenticate()
メソッドを使用し、プリンシパルを認証して、プリンシパルのクリデンシャルを取得します。C++ Secure Simpapp サンプル・アプリケーションのソース・ファイルは、BEA Tuxedo ソフトウェアの \samples
\corba
\simpappSSL
ディレクトリにあります。Secure Simpapp サンプル・アプリケーションの作成と実行の手順については、CORBA サンプル・アプリケーションのビルドと実行を参照してください。
CORBA クライアント・アプリケーションの記述
証明書による認証を使用する場合、以下を実行するクライアント・アプリケーション・コードを記述します。
corbalocs
URL
アドレス形式を使用します。
SecurityLevel2::PrincipalAuthenticator
インターフェイスの
authenticate()
メソッドを使用し、プリンシパルを認証して、プリンシパ
ルのクリデンシャルを取得します。証明書による認証を使用する場合、
method
引数に Tobj::CertificateBased
を指定し、Security::Opaque
の
auth_data
引数として秘密鍵のパス・フレーズを指定します。
次の節には、証明書による認証のインプリメントを示す C++ および Java のコード例があります。
証明書による認証の C++ コード例
リスト 10-7 では、C++ CORBA クライアント・アプリケーションでの証明書による認証の使用を示します。
リスト 10-7 証明書による認証を使用する CORBA C++ クライアント・アプリケーション
....
//ORB を初期化
CORBA::ORB_var v_orb = CORBA::ORB_init(argc, argv, "");
//Bootstrap オブジェクトを作成
Tobj_Bootstrap bootstrap(v_orb.in(), corbalocs://sling.com:2143);
//SecurityCurrent を解決
CORBA::Object_ptr seccurobj =
bootstrap.resolve_initial_references("SecurityCurrent");
SecurityLevel2::Current_ptr seccur =
SecurityLevel2::Current::_narrow(seccurobj);
//証明書ベースの認証を実行
SecurityLevel2::Credentials_ptr the_creds;
Security::AttributeList_var privileges;
Security::Opaque_var continuation_data;
Security::Opaque_var auth_specific_data;
Security::Opaque_var response_data;
//プリンシパルの電子メール・アドレス
char emailAddress[] = "milozzi@bigcompany.com;"
//プリンシパルのデジタル証明書のパス・フレーズ
char password[] = "asdawrewe98infldi7;"
//証明書プライベート・キー・パスワードをオペークに変換
unsigned long password_len = strlen(password);
Security::Opaque ssl_auth_data(password_len);
//Principal Authenticator でプリンシパルの証明書を認証
for(int i = 0; (unsigned long) i < password_len; i++)
ssl_auth_data[i] = password[i];
Security::AuthenticationStatus auth_status;
SecurityLevel2::PrincipalAuthenticator_var PA =
seccur->principal_authenticator();
auth_status = PA->authenticate(Tobj::CertificateBased,
emailAddress,
ssl_auth_data,
privileges,
the_creds,
continuation_data,
auth_specific_data);
while(auth_status == Security::SecAuthContinue) {
auth_status = PA->continue_authentication(
response_data,
the_creds,
continuation_data,
auth_specific_data);
}
...
証明書による認証の Java コード例
リスト 10-8 では、CORBA Java クライアント・アプリケーションでの証明書による認証の使用を示します。
リスト 10-8 証明書による認証を使用する CORBA Java クライアント・アプリケーション
...
//ORB を初期化
Properties Prop;
Prop = new Properties(System.getProperties());
Prop.put("org.omg.CORBA.ORBClass","com.beasys.CORBA.iiop.ORB");
Prop.put("org.omg.CORBA.ORBSingletonClass",
"com.beasys.CORBA.idl.ORBSingleton");
ORB orb = ORB.init(args, Prop);
//Bootstrap オブジェクトを作成
Tobj_Bootstrap bs = new Tobj_Bootstrap(orb,
corbalocs://foo:2501);
//SecurityCurrent を解決
org.omg.CORBA.object ocurr =
bs.resolve_initial_references("SecurityCurrent");
org.omg.SecurityLevel2.Current curr =
org.omg.SecurityLevel2.CurrentHelper.narrow(occur);
//Principal Authenticator を取得
com.beasys.Tobj.PrincipalAuthenticator pa =
(com.beasys.Tobj.PrincipalAuthenticator)
curr.principal_authenticator();
OpaqueHolder auth_data = new OpaqueHolder();
AttributeListHolder privileges = new AttributeListHolder();
org.omg.SecurityLevel2.CredentialsHolder creds =
new org.omg.SecurityLevel2.CredentialsHolder();
OpaqueHolder continuation_data = new OpaqueHolder();
OpaqueHolder auth_specific_data = new OpaqueHolder();
auth_data.value=new String ("deathstar").getbytes("UTF8);
if(pa.authenticate(com.beasys.Tobj.CertificateBased.value,
"vader@largecompany.com",
auth_data.value,
privileges.value,
the_creds,
continuation_data,
auth_specific_data)
!AuthenticationStatus.SecAuthSuccess) {
System.err.println("logon failed");
System.exit(1);
}
...
インターオペラブル・ネーミング・サービス・メカニズムの使用
注記 このメカニズムは、サード・パーティのクライアント ORB で使用します。
インターオペラブル・ネーミング・サービス・メカニズムを使用し、適切なクリデンシャルで BEA Tuxedo ドメインにアクセスするには、次の手順を実行します。
ORB::resolve_initial_references()
オペレーションを使用して、BEA
Tuxedo ドメインの SecurityLevel2::PrincipalAuthenticator
オブジェ
クトを取得します。SecurityLevel2::PrincipalAuthenticator
オブジェ
クトは、固有の BEA 委譲型インターフェイスではなく、標準 CORBA サー
ビス・セキュリティ・サービスに従い、認証プリンシパルを目的としたメ
ソッドが含まれます。
SecurityLevel2::PrincipalAuthenticator
オブジェクトの
authenticate()
メソッドを使用して、BEA Tuxedo ドメインにアクセスし、
そのドメインに対してクライアント ORB を認証します。BEA Tuxedo ドメ
インへのアクセスにセキュリティ・クリデンシャルが必要な場合、
authenticate()
メソッドは、引き続き認証が必要であることを示す状態を
返します。
SecurityLevel2::PrincipalAuthenticator
インターフェイスの
continue_authentication()
メソッドを使用し、暗号化されたログオンと
クリデンシャル情報を BEA Tuxedo ドメインに渡します。
CORBA インターオペラブル・ネーミング・サービス (INS) メカニズム使用の詳細については、「CORBA ブートストラップ処理のプログラミング・リファレンス」の SecurityLevel2::PrincipalAuthenticator
インターフェイスの項目を参照してください。
invocations_options_required() メソッドの使用
証明書による認証を使用する場合、プリンシパルで必要なセキュリティ属性を定義しなければならない場合があります。たとえば、銀行取引アプリケーションでは、データをデータベースに転送する前に、特定のセキュリティ要件を満たさなければならない可能性があります。SecurityLevel2::Credentials
インターフェイスの invocation_options_required()
メソッドを使用すると、プリンシパルは、SSL 接続のセキュリティ特性を明示的に制御できるようになります。corbaloc
URL アドレス形式を使用する場合、SecurityLevel2::Credentials
インターフェイスの authenticate()
メソッドと invocation_options_required()
メソッドを使用し、ブートストラップ処理をセキュリティで保護できます。
invocation_options_required()
メソッドを使用するには、次の手順を実行します。
SecurityLevel2::PrincipalAuthenticator
オブジェクトの
authenticate()
メソッドを使用するアプリケーション・コードを記述し、
証明書による認証が使用されるようにします。
invocation_options_required()
メソッドを使用して、プリンシパルで必
要なセキュリティ属性を指定します。セキュリティ・オプションのリストに
ついては、C++ セキュリティ・リファレンスおよびJava セキュリティ・リ
ファレンスの invocation_options_required()
メソッドの項目を参照して
ください。
リスト 10-9 では、invocation_options_required()
メソッドを使用した C++ の例を示します。
リスト 10-9 invocation_options_required() メソッドを使用した C++ の例
//ORB を初期化
CORBA::ORB_var v_orb = CORBA::ORB_init(argc, argv, "");
//Bootstrap オブジェクトを作成
Tobj_Bootstrap bootstrap(v_orb.in(), corbalocs://sling.com:2143);
//SecurityCurrent を解決
CORBA::Object_ptr seccurobj =
bootstrap.resolve_initial_references("SecurityCurrent");
SecurityLevel2::Current_ptr seccur =
SecurityLevel2::Current::_narrow(seccurobj);
//証明書ベースの認証を実行
SecurityLevel2::Credentials_ptr the_creds;
Security::AttributeList_var privileges;
Security::Opaque_var continuation_data;
Security::Opaque_var auth_specific_data;
Security::Opaque_var response_data;
//プリンシパルの電子メール・アドレス
char emailAddress[] = "milozzi@bigcompany.com;"
// Pass phrase for principal's digital certificate
char password[] = "asdawrewe98infldi7;"
//証明書プライベート・キー・パスワードをオペークに変換
unsigned long password_len = strlen(password);
Security::Opaque ssl_auth_data(password_len);
//Principal Authenticator でプリンシパルの証明書を認証
for(int i = 0; (unsigned long) i < password_len; i++)
ssl_auth_data[i] = password[i];
Security::AuthenticationStatus auth_status;
SecurityLevel2::PrincipalAuthenticator_var PA =
seccur->principal_authenticator();
auth_status = PA->authenticate(Tobj::CertificateBased,
emailAddress,
ssl_auth_data,
privileges,
the_creds,
continuation_data,
auth_specific_data);
the_creds->invocation_options_required(
Security::Integrity|
Security::DetectReplay|
Security::DetectMisordering|
Security::EstablishTrustInTarget|
Security::EstalishTrustInClient|
Security::SimpleDelegation);
while(auth_status == Security::SecAuthContinue) {
auth_status = PA->continue_authentication(
response_data,
the_creds,
continuation_data,
auth_specific_data);
}
...
リスト 10-10 では、invocation_options_required()
メソッドを使用した Java の例を示します。
リスト 10-10 invocation_options_required() メソッドを使用した Java の例
...
//ORB を初期化
Properties Prop;
Prop = new Properties(System.getProperties());
Prop.put("org.omg.CORBA.ORBClass","com.beasys.CORBA.iiop.ORB");
Prop.put("org.omg.CORBA.ORBSingletonClass",
"com.beasys.CORBA.idl.ORBSingleton");
ORB orb = ORB.init(args, Prop);
//Bootstrap オブジェクトを作成
Tobj_Bootstrap bs = new Tobj_Bootstrap(orb,
corbalocs://foo:2501);
//SecurityCurrent を解決
org.omg.CORBA.object ocurr =
bs.resolve_initial_references("SecurityCurrent");
org.omg.SecurityLevel2.Current curr =
org.omg.SecurityLevel2.CurrentHelper.narrow(occur);
//Principal Authenticator を取得
com.beasys.Tobj.PrincipalAuthenticator pa =
(com.beasys.Tobj.PrincipalAuthenticator)
curr.principal_authenticator();
OpaqueHolder auth_data = new OpaqueHolder();
AttributeListHolder privileges = new AttributeListHolder();
org.omg.SecurityLevel2.CredentialsHolder creds =
new org.omg.SecurityLevel2.CredentialsHolder();
OpaqueHolder continuation_data = new OpaqueHolder();
OpaqueHolder auth_specific_data = new OpaqueHolder();
auth_data.value=new String ("deathstar").getbytes("UTF8);
if(pa.authenticate(com.beasys.Tobj.CertificateBased.value,
"vader@largecompany.com",
auth_data.value,
privileges.value,
the_creds,
continuation_data,
auth_specific_data)org.omg.SecurityLevel2.Credentials credentials = curr.get_credentials(
org.omg.Security.CredentialType.SecInvocationCredentials);credentials.invocation_options_required(
!AuthenticationStatus.SecAuthSuccess) {
(short) (org.omg.Security.Integrity.value |
org.omg.Security.DetectReplay.value|
org.omg.Security.DetectMisordering.value|
org.omg.Security.EstablishTrustInTarget.value|
org.omg.Security.EstablishTrustInClient.value|
org.omg.Security.SimpleDelegation.value)
);
System.err.println("logon failed");
System.exit(1);
}
...
|
Copyright © 2001, BEA Systems, Inc. All rights reserved.
|