diff --git a/api/src/main/java/jakarta/security/auth/message/config/AuthConfigFactory.java b/api/src/main/java/jakarta/security/auth/message/config/AuthConfigFactory.java index 8ddb606..7238073 100644 --- a/api/src/main/java/jakarta/security/auth/message/config/AuthConfigFactory.java +++ b/api/src/main/java/jakarta/security/auth/message/config/AuthConfigFactory.java @@ -27,6 +27,8 @@ import java.util.Map; import java.util.Properties; +import jakarta.security.auth.message.module.ServerAuthModule; + /** * This class is used to obtain AuthConfigProvider objects that can be used to obtain authentication * context configuration objects, that is, ClientAuthConfig and ServerAuthConfig objects. @@ -376,6 +378,35 @@ public static synchronized void setFactory(AuthConfigFactory factory) { */ public abstract String registerConfigProvider(AuthConfigProvider provider, String layer, String appContext, String description); + /** + * Registers within the (in-memory) factory, an instance of a ServerAuthModule for a + * message layer and application context identifier as identified by a profile specific context object. + * + *

+ * This will override any other modules that have already been registered, either via proprietary + * means or using the standard API. + * + * @param serverAuthModule the ServerAuthModule instance to be registered + * @param context the profile specific context of the application for which the module is registered + * @return A String identifier assigned by the factory to the provider registration, and that may be used to remove the + * registration from the factory. + */ + public abstract String registerServerAuthModule(ServerAuthModule serverAuthModule, Object context); + + /** + * Remove the ServerAuthModule (and potentially encompassing wrappers/factories) that was previously registered via a call + * to registerServerAuthModule. + * + *

+ * Note that this method is a convenience method that can be used instead of removeRegistration, but should ultimately + * have the same effect. That is calling removeRegistration with the return value from registerServerAuthModule + * must have the same effect in that the ServerAuthModule is removed. + * + * @param context the profile specific context of the application for which the module is removed. + */ + public abstract void removeServerAuthModule(Object context); + + /** * Remove the identified provider registration from the factory (and from the persistent declarative representation of * provider registrations, if appropriate) and invoke any listeners associated with the removed registration.