アノテーション型 WithSecurityContext
@Target(ANNOTATION_TYPE) @Retention(RUNTIME) @Inherited @Documented public @interface WithSecurityContext
使用する
SecurityContext
を決定するためのアノテーション。factory()
属性には、WithUserDetailsSecurityContextFactory
のインスタンスを指定する必要があります。通常、このアノテーションは、
WithMockUser
およびWithUserDetails
で行われるようにメタアノテーションとして使用されます。WithSecurityContextFactory
の独自の実装を作成したい場合は、インターフェースを実装することで作成できます。WithSecurityContextFactory
実装では、Autowired
およびその他の Spring セマンティクスを使用することもできます。- 導入:
- 4.0
必須定数のサマリー
必須要素 修飾子と型 必須要素 説明 java.lang.Class<? extends WithSecurityContextFactory<? extends java.lang.annotation.Annotation>>
factory
SecurityContext
の作成に使用するWithUserDetailsSecurityContextFactory
。
オプション要素のサマリー
オプション要素 修飾子と型 オプションの要素 説明 TestExecutionEvent
setupBefore
SecurityContext
がいつセットアップされるかを決定します。
要素の詳細
factory
java.lang.Class<? extends WithSecurityContextFactory<? extends java.lang.annotation.Annotation>> factory
SecurityContext
の作成に使用するWithUserDetailsSecurityContextFactory
。Autowired
およびその他の Spring アノテーションを含めることができます。- 戻り値:
setupBefore
TestExecutionEvent setupBefore
SecurityContext
がいつセットアップされるかを決定します。デフォルトは、TestExecutionListener.beforeTestMethod(TestContext)
の間に発生するTestExecutionEvent.TEST_METHOD
の前です。- 戻り値:
- 前に初期化する
TestExecutionEvent
- 導入:
- 5.1
- デフォルト:
- org.springframework.security.test.context.support.TestExecutionEvent.TEST_METHOD