1919import org .jivesoftware .admin .AuthCheckFilter ;
2020import org .jivesoftware .openfire .container .Plugin ;
2121import org .jivesoftware .openfire .container .PluginManager ;
22+ import org .jivesoftware .openfire .keystore .CertificateStore ;
2223import org .jivesoftware .openfire .plugin .rest .service .JerseyWrapper ;
2324import org .jivesoftware .openfire .stats .StatisticsManager ;
25+ import org .jivesoftware .util .CertificateEventListener ;
26+ import org .jivesoftware .util .CertificateManager ;
2427import org .jivesoftware .util .JiveGlobals ;
2528import org .jivesoftware .util .PropertyEventDispatcher ;
2629import org .jivesoftware .util .PropertyEventListener ;
3235/**
3336 * The Class RESTServicePlugin.
3437 */
35- public class RESTServicePlugin implements Plugin , PropertyEventListener {
38+ public class RESTServicePlugin implements Plugin , PropertyEventListener , CertificateEventListener {
3639
3740 private static final String CUSTOM_AUTH_FILTER_PROPERTY_NAME = "plugin.restapi.customAuthFilter" ;
3841 public static final String SERVICE_LOGGING_ENABLED = "plugin.restapi.serviceLoggingEnabled" ;
@@ -99,6 +102,9 @@ public void initializePlugin(PluginManager manager, File pluginDirectory) {
99102 // Listen to system property events
100103 PropertyEventDispatcher .addListener (this );
101104
105+ // Re-register the URL exclusion if the admin console restarts (e.g. on certificate change)
106+ CertificateManager .addListener (this );
107+
102108 // Exclude this servlet from requering the user to login
103109 AuthCheckFilter .addExclude (JerseyWrapper .SERVLET_URL );
104110 }
@@ -118,6 +124,17 @@ public void destroyPlugin() {
118124 AuthCheckFilter .removeExclude (JerseyWrapper .SERVLET_URL );
119125 // Stop listening to system property events
120126 PropertyEventDispatcher .removeListener (this );
127+ CertificateManager .removeListener (this );
128+ }
129+
130+ /**
131+ * Re-registers the URL exclusion with the admin console's AuthCheckFilter after a certificate
132+ * store change, which triggers an admin console restart that would otherwise clear plugin-
133+ * registered excludes.
134+ */
135+ @ Override
136+ public void storeContentChanged (CertificateStore store ) {
137+ AuthCheckFilter .addExclude (JerseyWrapper .SERVLET_URL );
121138 }
122139
123140 /**
0 commit comments