Class ThreadLocalX509TrustEngineContext
- java.lang.Object
-
- org.opensaml.security.x509.tls.impl.ThreadLocalX509TrustEngineContext
-
public final class ThreadLocalX509TrustEngineContext extends Object
Class which holds and makes available instances ofTrustEngine<? superX509Credential>andCriteriaSetvia ThreadLocal storage, typically used for server TLS authentication viaThreadLocalX509TrustManager.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classThreadLocalX509TrustEngineContext.Data
-
Field Summary
Fields Modifier and Type Field Description private static ThreadLocal<ThreadLocalX509TrustEngineContext.Data>currentThreadLocal storage for trust engine.
-
Constructor Summary
Constructors Modifier Constructor Description privateThreadLocalX509TrustEngineContext()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclearCurrent()Clear the current thread-local credential.static CriteriaSetgetCriteria()Return the current thread-local criteria instance.static BooleangetTrusted()Return the current thread-local trust evaluation data.static TrustEngine<? super X509Credential>getTrustEngine()Return the current thread-local trust engine instance.static booleanhaveCurrent()Get whether the current thread-local is populated with non-null data.static BooleanisFailureFatal()Return whether failure of server TLS is to be treated as fatal.static voidloadCurrent(TrustEngine<? super X509Credential> trustEngine, CriteriaSet criteria, Boolean fatal)Load the thread-local storage with the current credential.static voidsetTrusted(Boolean trusted)Set the current thread-local trust evaluation data.
-
-
-
Field Detail
-
current
private static ThreadLocal<ThreadLocalX509TrustEngineContext.Data> current
ThreadLocal storage for trust engine.
-
-
Method Detail
-
loadCurrent
public static void loadCurrent(@Nonnull TrustEngine<? super X509Credential> trustEngine, @Nonnull CriteriaSet criteria, @Nullable Boolean fatal)Load the thread-local storage with the current credential.- Parameters:
trustEngine- the current trust enginecriteria- the current criteriafatal- whether trust engine evaluation failure should be treated as fatal. Defaults to true.
-
clearCurrent
public static void clearCurrent()
Clear the current thread-local credential.
-
haveCurrent
public static boolean haveCurrent()
Get whether the current thread-local is populated with non-null data.- Returns:
- true if thread-local has non-null data, false otherwise
-
getTrustEngine
@Nullable public static TrustEngine<? super X509Credential> getTrustEngine()
Return the current thread-local trust engine instance.- Returns:
- the current trust engine
-
getCriteria
@Nullable public static CriteriaSet getCriteria()
Return the current thread-local criteria instance.- Returns:
- the current criteria
-
isFailureFatal
@Nonnull public static Boolean isFailureFatal()
Return whether failure of server TLS is to be treated as fatal.- Returns:
- true if fatal, false if not
-
getTrusted
@Nullable public static Boolean getTrusted()
Return the current thread-local trust evaluation data.- Returns:
- the current trust evaluation data
-
setTrusted
public static void setTrusted(@Nullable Boolean trusted)Set the current thread-local trust evaluation data.- Parameters:
trusted- the current trust evaluation data
-
-