クラス Wss4jSecurityInterceptor
- 実装されたすべてのインターフェース:
org.springframework.beans.factory.InitializingBean
、ClientInterceptor
、EndpointInterceptor
、SoapEndpointInterceptor
org.springframework.ws.soap.axiom.AxiomSoapMessageFactory
および SaajSoapMessageFactory
によって作成されたメッセージをサポートします。 このインターセプターによって実行される検証アクションと保護アクションは、それぞれ validationActions
プロパティと securementActions
プロパティを介して構成されます。アクションは、スペースで区切られた文字列として渡す必要があります。
有効な検証アクションは次のとおりです。
検証アクション 説明 UsernameToken
ユーザー名トークンを検証します Timestamp
タイムスタンプを検証します Encrypt
メッセージを復号化します Signature
署名を検証します NoSecurity
アクションは実行されません
保護アクションは次のとおりです。
固定アクション 説明 UsernameToken
ユーザー名トークンを追加します UsernameTokenSignature
ユーザー名トークンと署名ユーザー名トークン秘密鍵を追加します Timestamp
タイムスタンプを追加します Encrypt
レスポンスを暗号化します Signature
レスポンスに署名します NoSecurity
アクションは実行されません
メッセージを保護するためにクライアントが実行したアクションの順序は重要であり、インターセプターによって強制されます。
- 導入:
- 2.3.0
- 作成者:
- Tareq Abed Rabbo, Arjen Poutsma, Greg Turnquist, Jamin Hitchcock, Rob Leland
- 関連事項:
フィールドのサマリー
フィールドクラス org.springframework.ws.soap.security.AbstractWsSecurityInterceptor から継承されたフィールド
logger, WS_SECURITY_NAME
コンストラクターの概要
コンストラクターコンストラクター説明デフォルトでWSSecurityEngine
を作成します。Wss4jSecurityInterceptor
(org.apache.wss4j.dom.engine.WSSecurityEngine securityEngine) カスタマイズしたWSSecurityEngine
を挿入します。メソッドのサマリー
修飾子と型メソッド説明void
protected void
checkResults
(ListSE<org.apache.wss4j.dom.engine.WSSecurityEngineResult> results, ListSE<IntegerSE> validationActions) 受信したヘッダーが構成済みの検証アクションと一致するかどうかを確認します。protected void
cleanUp()
boolean
protected org.apache.wss4j.dom.handler.RequestData
initializeRequestData
(MessageContext messageContext) 指定されたメッセージコンテキストのリクエストデータを作成して初期化します。protected org.apache.wss4j.dom.handler.RequestData
initializeValidationRequestData
(MessageContext messageContext) 指定されたメッセージコンテキストのリクエストデータを作成して初期化します。protected void
secureMessage
(SoapMessage soapMessage, MessageContext messageContext) 抽象テンプレートメソッド。void
setAddInclusivePrefixes
(boolean addInclusivePrefixes) WSConstants.C14N_EXCL_OMIT_COMMENTS を使用して署名を生成するときに , InclusiveNamespaces PrefixList を CanonicalizationMethod の子として追加するかどうかを設定します。void
setAllowRSA15KeyTransportAlgorithm
(boolean allow) RSA 1.5 キートランスポートアルゴリズムを許可するかどうかを設定します。void
setBspCompliant
(boolean bspCompliant) WS-I 基本セキュリティプロファイルコンプライアンスモードを設定します。void
setEnableRevocation
(boolean enableRevocation) 証明書の信頼を確認するときに CRL チェックを有効にするかどうかを設定します。void
setEnableSignatureConfirmation
(boolean enableSignatureConfirmation) signatureConfirmation を有効にするかどうか。void
setFutureTimeToLive
(int futureTimeToLive) 受信タイムスタンプの作成時刻が有効になる将来の時刻を秒単位で設定します。void
setRemoveSecurityHeader
(boolean removeSecurityHeader) void
setSecurementActions
(StringSE securementActions) void
setSecurementActor
(StringSE securementActor) wsse:Security
ヘッダーのアクター名。void
setSecurementEncryptionCrypto
(org.apache.wss4j.common.crypto.Crypto securementEncryptionCrypto) void
setSecurementEncryptionKeyIdentifier
(StringSE securementEncryptionKeyIdentifier) 使用するキー識別子の型を定義します。void
setSecurementEncryptionKeyTransportAlgorithm
(StringSE securementEncryptionKeyTransportAlgorithm) 生成された対称鍵の暗号化に使用するアルゴリズムを定義します。void
setSecurementEncryptionParts
(StringSE securementEncryptionParts) リクエストのどの部分を暗号化するかを定義するプロパティ。void
setSecurementEncryptionSymAlgorithm
(StringSE securementEncryptionSymAlgorithm) 使用する対称暗号化アルゴリズムを定義します。void
setSecurementEncryptionUser
(StringSE securementEncryptionUser) 暗号化のためのユーザーの名前。void
setSecurementMustUnderstand
(boolean securementMustUnderstand) 送信メッセージの WS-Security ヘッダーでmustUnderstand
属性を有効にします。void
setSecurementPassword
(StringSE securementPassword) void
setSecurementPasswordType
(StringSE securementUsernameTokenPasswordType) passowrd のエンコーディングを定義するための UsernameToken アクションの特定のパラメーター。void
setSecurementSamlCallbackHandler
(CallbackHandlerSE samlCallbackHandler) SAML トークンの生成に使用される SAML コールバックを設定します。void
setSecurementSignatureAlgorithm
(StringSE securementSignatureAlgorithm) 使用する署名アルゴリズムを定義します。void
setSecurementSignatureCrypto
(org.apache.wss4j.common.crypto.Crypto securementSignatureCrypto) void
setSecurementSignatureDigestAlgorithm
(StringSE digestAlgorithm) 使用するシグニチャダイジェストアルゴリズムを定義します。void
setSecurementSignatureKeyIdentifier
(StringSE securementSignatureKeyIdentifier) 使用するキー識別子の型を定義します。void
setSecurementSignatureParts
(StringSE securementSignatureParts) リクエストのどの部分に署名するかを定義するプロパティ。void
setSecurementSignatureUser
(StringSE securementSignatureUser) 署名用のユーザー名。void
setSecurementTimeToLive
(int securementTimeToLive) 送信メッセージの存続時間を設定しますvoid
setSecurementUseDerivedKey
(boolean securementUseDerivedKey) UsernameTokenProfile 1.1 仕様に従ってキーの派生を有効にします。void
setSecurementUsername
(StringSE securementUsername) 保護ユーザー名トークンのユーザー名または / および保護署名の秘密鍵のエイリアスを設定しますvoid
setSecurementUsernameTokenCreated
(boolean securementUsernameTokenCreated) Created
要素をUsernameToken
に追加するかどうかを設定します。void
setSecurementUsernameTokenNonce
(boolean securementUsernameTokenNonce) Nonce
要素をUsernameToken
に追加するかどうかを設定します。void
setTimestampPrecisionInMilliseconds
(boolean timestampPrecisionInMilliseconds) 生成されたタイムスタンプヘッダーの精度がミリ秒単位であるかどうかを設定します。void
setTimestampStrict
(boolean timestampStrict) サーバー側の存続時間でタイムスタンプ検証を実行するかどうかを設定しますvoid
setValidationActions
(StringSE actions) インターセプターによって実行される検証アクションを設定します。void
setValidationActor
(StringSE validationActor) void
setValidationCallbackHandler
(CallbackHandlerSE callbackHandler) メッセージの検証時に使用するCallbackHandler
SE を設定します。void
setValidationCallbackHandlers
(CallbackHandlerSE[] callbackHandler) メッセージの検証時に使用するCallbackHandler
SE を設定します。void
setValidationDecryptionCrypto
(org.apache.wss4j.common.crypto.Crypto decryptionCrypto) 受信メッセージの復号化に使用する暗号を設定しますvoid
setValidationSignatureCrypto
(org.apache.wss4j.common.crypto.Crypto signatureCrypto) 受信メッセージの署名を検証するために使用する暗号を設定しますvoid
setValidationTimeToLive
(int validationTimeToLive) サーバー側の存続時間を設定しますvoid
setWssConfig
(org.apache.wss4j.dom.engine.WSSConfig config) Web サービス仕様の設定を行います。protected void
validateMessage
(SoapMessage soapMessage, MessageContext messageContext) 抽象テンプレートメソッド。protected void
verifyCertificateTrust
(org.apache.wss4j.dom.handler.WSHandlerResult result) 証明書の信頼性を検証します。protected void
verifyTimestamp
(org.apache.wss4j.dom.handler.WSHandlerResult result) タイムスタンプを確認します。クラス org.springframework.ws.soap.security.AbstractWsSecurityInterceptor から継承されたメソッド
afterCompletion, afterCompletion, handleFault, handleFault, handleFaultException, handleRequest, handleRequest, handleResponse, handleResponse, handleSecurementException, handleValidationException, setExceptionResolver, setSecureRequest, setSecureResponse, setSkipValidationIfNoHeaderPresent, setValidateRequest, setValidateResponse, understands
フィールドの詳細
SECUREMENT_USER_PROPERTY_NAME
- 関連事項:
コンストラクターの詳細
Wss4jSecurityInterceptor
public Wss4jSecurityInterceptor()デフォルトでWSSecurityEngine
を作成します。Wss4jSecurityInterceptor
public Wss4jSecurityInterceptor(org.apache.wss4j.dom.engine.WSSecurityEngine securityEngine) カスタマイズしたWSSecurityEngine
を挿入します。- パラメーター:
securityEngine
-
メソッドの詳細
setSecurementActions
setSecurementActor
wsse:Security
ヘッダーのアクター名。このパラメーターを省略すると、アクター名は設定されません。
アクターまたはロールの値は、レシーバーの設定と一致する必要があります。または、標準値が含まれている場合があります。
setSecurementEncryptionCrypto
public void setSecurementEncryptionCrypto(org.apache.wss4j.common.crypto.Crypto securementEncryptionCrypto) setSecurementEncryptionKeyIdentifier
使用するキー識別子の型を定義します。WS-Security 仕様では、識別子型IssuerSerial
の使用を推奨しています。可能な暗号化キー識別子型については、org.apache.ws.security.handler.WSHandlerConstants#keyIdentifier
を参照してください。暗号化の場合、IssuerSerial
、X509KeyIdentifier
、DirectReference
、Thumbprint
、SKIKeyIdentifier
、EmbeddedKeyName
はのみ有効です。setSecurementEncryptionKeyTransportAlgorithm
public void setSecurementEncryptionKeyTransportAlgorithm(StringSE securementEncryptionKeyTransportAlgorithm) 生成された対称鍵の暗号化に使用するアルゴリズムを定義します。現在、WSS4J はWSS4JConstants.KEYTRANSPORT_RSA15
およびWSConstants#KEYTRANSPORT_RSAOEP
をサポートしています。setSecurementEncryptionParts
リクエストのどの部分を暗号化するかを定義するプロパティ。このプロパティの値は、暗号化する要素を識別するセミコロンで区切られた要素名のリストです。暗号化モード指定子と名前空間 ID は、それぞれカーリー括弧のペア内にあり、各要素名の前に付けることができます。
暗号化モード指定子は、
{Content}
または{Element}
のいずれかです。要素暗号化とコンテンツ暗号化の違いについては、W3CXML 暗号化仕様を参照してください。暗号化モードを省略すると、デフォルトでContent
になります。リストの例:<property name="securementEncryptionParts" value="{Content}{http://example.org/paymentv2}CreditCard; {Element}{}UserName" />
リストの最初のエントリは、名前空間http://example.org/paymentv2
内の要素CreditCard
を識別し、そのコンテンツを暗号化します。要素名、名前空間識別子、暗号化修飾子では大文字と小文字が区別されることに注意してください。暗号化修飾子と名前空間識別子は省略できます。この場合、暗号化モードはデフォルトで
Content
に設定され、名前空間は SOAP 名前空間に設定されます。空の暗号化モードはデフォルトで
Content
になり、空の名前空間識別子はデフォルトで SOAP 名前空間になります。例の 2 行目では、Element
を SOAP 名前空間のUserName
要素の暗号化モードとして定義しています。名前空間のない要素を指定するには、名前空間名として文字列
Null
を使用します (これは大文字と小文字を区別する文字列です)リストが指定されていない場合、ハンドラーはデフォルトで
Content
モードで SOAP 本体を暗号化します。setSecurementEncryptionSymAlgorithm
使用する対称暗号化アルゴリズムを定義します。WSS4J は、次のアルゴリズムをサポートしています:WSS4JConstants.TRIPLE_DES
、WSS4JConstants.AES_128
、WSS4JConstants.AES_256
、WSS4JConstants.AES_192
. AES 192 を除いて、これらのアルゴリズムはすべて XML 暗号化仕様で要求されています。setSecurementEncryptionUser
暗号化のためのユーザーの名前。暗号化機能は、このユーザーの証明書の公開鍵を使用して、生成された対称鍵を暗号化します。
このパラメーターが設定されていない場合、暗号化機能は
org.apache.ws.security.handler.WSHandlerConstants#USER
パラメーターにフォールバックして証明書を取得します。SOAP 本体データの暗号化のみがリクエストされる場合は、このパラメーターを使用してユーザー名を定義することをお勧めします。その後、アプリケーションは標準のユーザーおよびパスワード機能を使用できます(HTTP 認証機能を有効にするには
org.apache.ws.security.handler.WSHandlerConstants#USER
の例を参照してください)。暗号化はユーザー / 送信者を認証するだけではないため、パスワードは必要ありません。
暗号化証明書のユーザー名を構成ファイルに配置しても、その証明書の公開鍵のみが使用されるため、セキュリティ上のリスクはありません。
setSecurementPassword
setSecurementPasswordType
passowrd のエンコーディングを定義するための UsernameToken アクションの特定のパラメーター。パラメーターは、
WSS4JConstants.PW_DIGEST
またはWSS4JConstants.PW_TEXT
のいずれかに設定できます。デフォルト設定は PW_DIGEST です。
setSecurementSignatureAlgorithm
使用する署名アルゴリズムを定義します。- 関連事項:
WSS4JConstants.RSA
WSS4JConstants.DSA
setSecurementSignatureDigestAlgorithm
使用するシグニチャダイジェストアルゴリズムを定義します。setSecurementSignatureCrypto
public void setSecurementSignatureCrypto(org.apache.wss4j.common.crypto.Crypto securementSignatureCrypto) setSecurementSignatureKeyIdentifier
使用するキー識別子の型を定義します。WS-Security 仕様では、識別子型IssuerSerial
の使用を推奨しています。可能な署名キー識別子型については、org.apache.ws.security.handler.WSHandlerConstants#keyIdentifier
を参照してください。署名の場合、IssuerSerial
およびDirectReference
はのみ有効です。setSecurementSignatureParts
リクエストのどの部分に署名するかを定義するプロパティ。値の文字列の形式の詳細については、
setSecurementEncryptionParts(String)
を参照してください。このプロパティが指定されていない場合、ハンドラーはデフォルトで SOAP 本体に署名します。
WS Security 仕様では、署名トークン(証明書)またはこれらのトークンへの参照を転送するためのいくつかの形式が定義されています。プレーン要素名
Token
はトークンに署名し、さまざまな形式を処理します。SOAP 本体と 署名トークンに署名するには、このパラメーターの値に次のものが含まれている必要があります。
<property name="securementSignatureParts" value="{}{http://schemas.xmlsoap.org/soap/envelope/}Body; Token" />
名前空間のない要素を指定するには、名前空間名として文字列Null
を使用します (これは大文字と小文字を区別する文字列です)ローカル名が
Body
の要素がリクエストに他にない場合は、SOAP 名前空間識別子を空にすることができます({}
)。setSecurementSignatureUser
署名用のユーザー名。この名前は、署名を実行するためのユーザーの証明書と秘密鍵を取得するためのキーストアのエイリアス名として使用されます。
このパラメーターが設定されていない場合、署名機能は
setSecurementUsername(String)
で指定された別名にフォールバックします。setSecurementUsername
保護ユーザー名トークンのユーザー名または / および保護署名の秘密鍵のエイリアスを設定しますsetSecurementTimeToLive
public void setSecurementTimeToLive(int securementTimeToLive) 送信メッセージの存続時間を設定しますsetSecurementUseDerivedKey
public void setSecurementUseDerivedKey(boolean securementUseDerivedKey) UsernameTokenProfile 1.1 仕様に従ってキーの派生を有効にします。デフォルトはtrue
です。setSecurementSamlCallbackHandler
SAML トークンの生成に使用される SAML コールバックを設定します。- パラメーター:
samlCallback
-
setValidationTimeToLive
public void setValidationTimeToLive(int validationTimeToLive) サーバー側の存続時間を設定しますsetValidationActions
インターセプターによって実行される検証アクションを設定します。setValidationActor
setValidationCallbackHandler
メッセージの検証時に使用するCallbackHandler
SE を設定します。setValidationCallbackHandlers
メッセージの検証時に使用するCallbackHandler
SE を設定します。setValidationDecryptionCrypto
public void setValidationDecryptionCrypto(org.apache.wss4j.common.crypto.Crypto decryptionCrypto) 受信メッセージの復号化に使用する暗号を設定しますsetValidationSignatureCrypto
public void setValidationSignatureCrypto(org.apache.wss4j.common.crypto.Crypto signatureCrypto) 受信メッセージの署名を検証するために使用する暗号を設定しますsetEnableSignatureConfirmation
public void setEnableSignatureConfirmation(boolean enableSignatureConfirmation) signatureConfirmation を有効にするかどうか。デフォルトでは signatureConfirmation が有効になっていますsetTimestampPrecisionInMilliseconds
public void setTimestampPrecisionInMilliseconds(boolean timestampPrecisionInMilliseconds) 生成されたタイムスタンプヘッダーの精度がミリ秒単位であるかどうかを設定します。setTimestampStrict
public void setTimestampStrict(boolean timestampStrict) サーバー側の存続時間でタイムスタンプ検証を実行するかどうかを設定しますsetSecurementMustUnderstand
public void setSecurementMustUnderstand(boolean securementMustUnderstand) 送信メッセージの WS-Security ヘッダーでmustUnderstand
属性を有効にします。デフォルトはtrue
です。setSecurementUsernameTokenNonce
public void setSecurementUsernameTokenNonce(boolean securementUsernameTokenNonce) Nonce
要素をUsernameToken
に追加するかどうかを設定します。デフォルトはfalse
です。setSecurementUsernameTokenCreated
public void setSecurementUsernameTokenCreated(boolean securementUsernameTokenCreated) Created
要素をUsernameToken
に追加するかどうかを設定します。デフォルトはfalse
です。setWssConfig
public void setWssConfig(org.apache.wss4j.dom.engine.WSSConfig config) Web サービス仕様の設定を行います。デフォルト設定は最新の OASIS に従い、何かを変更すると OASIS 仕様に違反する可能性があります。
- パラメーター:
config
- デフォルト設定を使用するための Web サービスセキュリティ構成またはnull
setEnableRevocation
public void setEnableRevocation(boolean enableRevocation) 証明書の信頼を確認するときに CRL チェックを有効にするかどうかを設定します。setBspCompliant
public void setBspCompliant(boolean bspCompliant) WS-I 基本セキュリティプロファイルコンプライアンスモードを設定します。デフォルトはtrue
です。setAddInclusivePrefixes
public void setAddInclusivePrefixes(boolean addInclusivePrefixes) WSConstants.C14N_EXCL_OMIT_COMMENTS を使用して署名を生成するときに , InclusiveNamespaces PrefixList を CanonicalizationMethod の子として追加するかどうかを設定します。デフォルトはtrue
です。setAllowRSA15KeyTransportAlgorithm
public void setAllowRSA15KeyTransportAlgorithm(boolean allow) RSA 1.5 キートランスポートアルゴリズムを許可するかどうかを設定します。setFutureTimeToLive
public void setFutureTimeToLive(int futureTimeToLive) 受信タイムスタンプの作成時刻が有効になる将来の時刻を秒単位で設定します。デフォルトは 60 秒です。getRemoveSecurityHeader
public boolean getRemoveSecurityHeader()setRemoveSecurityHeader
public void setRemoveSecurityHeader(boolean removeSecurityHeader) afterPropertiesSet
- 次で指定:
- インターフェース
org.springframework.beans.factory.InitializingBean
のafterPropertiesSet
- 例外:
ExceptionSE
secureMessage
protected void secureMessage(SoapMessage soapMessage, MessageContext messageContext) throws WsSecuritySecurementException クラスからコピーされた説明:AbstractWsSecurityInterceptor
抽象テンプレートメソッド。指定されたSoapMessage
に含まれるレスポンスを保護し、元のレスポンスを保護されたバージョンに置き換えるには、サブクラスが必要です。- 次で指定:
- クラス
AbstractWsSecurityInterceptor
のsecureMessage
- パラメーター:
soapMessage
- 保護する SOAP メッセージ- 例外:
WsSecuritySecurementException
- 保護エラーの場合
initializeRequestData
protected org.apache.wss4j.dom.handler.RequestData initializeRequestData(MessageContext messageContext) 指定されたメッセージコンテキストのリクエストデータを作成して初期化します。- パラメーター:
messageContext
- メッセージコンテキスト- 戻り値:
- リクエストデータ
initializeValidationRequestData
protected org.apache.wss4j.dom.handler.RequestData initializeValidationRequestData(MessageContext messageContext) 指定されたメッセージコンテキストのリクエストデータを作成して初期化します。- パラメーター:
messageContext
- メッセージコンテキスト- 戻り値:
- リクエストデータ
validateMessage
protected void validateMessage(SoapMessage soapMessage, MessageContext messageContext) throws WsSecurityValidationException クラスからコピーされた説明:AbstractWsSecurityInterceptor
抽象テンプレートメソッド。指定されたSoapMessage
に含まれるリクエストを検証し、元のリクエストを検証済みのバージョンに置き換えるには、サブクラスが必要です。- 次で指定:
- クラス
AbstractWsSecurityInterceptor
のvalidateMessage
- パラメーター:
soapMessage
- 検証する SOAP メッセージ- 例外:
WsSecurityValidationException
- 検証エラーの場合
checkResults
protected void checkResults(ListSE<org.apache.wss4j.dom.engine.WSSecurityEngineResult> results, ListSE<IntegerSE> validationActions) throws Wss4jSecurityValidationException 受信したヘッダーが構成済みの検証アクションと一致するかどうかを確認します。サブクラスは、カスタム検証動作のためにこのメソッドをオーバーライドできます。- パラメーター:
results
- 検証機能の結果validationActions
- デコードされた検証アクション- 例外:
Wss4jSecurityValidationException
- 結果が無効と見なされた場合
verifyCertificateTrust
protected void verifyCertificateTrust(org.apache.wss4j.dom.handler.WSHandlerResult result) throws org.apache.wss4j.common.ext.WSSecurityException 証明書の信頼性を検証します。- パラメーター:
result
-- 例外:
org.apache.wss4j.common.ext.WSSecurityException
verifyTimestamp
protected void verifyTimestamp(org.apache.wss4j.dom.handler.WSHandlerResult result) throws org.apache.wss4j.common.ext.WSSecurityException タイムスタンプを確認します。- パラメーター:
result
-- 例外:
org.apache.wss4j.common.ext.WSSecurityException
cleanUp
protected void cleanUp()- 次で指定:
- クラス
AbstractWsSecurityInterceptor
のcleanUp