This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit 5ab7baf5fb2d1136ccce24bc2764676247d28474 Author: Duncan Grant <[email protected]> AuthorDate: Tue Jun 1 09:20:16 2021 +0100 Fix issue where vault not ready on init If vault is used for security provider and is not ready on startup then the security provider will fail and will be replaced by the BlackholeSecurityProvider. This change means that whenever a security provider fails, the DelegatingSecurityProvider will attempt to re-initialize it on subsequent authorization attempts. --- .../rest/security/provider/DelegatingSecurityProvider.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/security/provider/DelegatingSecurityProvider.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/security/provider/DelegatingSecurityProvider.java index 0463cf0..4a9f556 100644 --- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/security/provider/DelegatingSecurityProvider.java +++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/security/provider/DelegatingSecurityProvider.java @@ -98,22 +98,25 @@ public class DelegatingSecurityProvider implements SecurityProvider { log.info("Brooklyn security: using security provider " + className + " from " + bundle+":"+bundleVersion); BundleContext bundleContext = ((ManagementContextInternal)mgmt).getOsgiManager().get().getFramework().getBundleContext(); delegate = loadProviderFromBundle(mgmt, bundleContext, bundle, bundleVersion, className); + saveDelegate(); } else { log.info("Brooklyn security: using security provider " + className); ClassLoaderUtils clu = new ClassLoaderUtils(this, mgmt); Class<? extends SecurityProvider> clazz = (Class<? extends SecurityProvider>) clu.loadClass(className); delegate = createSecurityProviderInstance(mgmt, clazz); + saveDelegate(); } } catch (Exception e) { log.warn("Brooklyn security: unable to instantiate security provider " + className + "; all logins are being disallowed", e); delegate = new BlackholeSecurityProvider(); } + return delegate; + } + private void saveDelegate() { // Deprecated in 0.11.0. Add to release notes and remove in next release. ((BrooklynProperties)mgmt.getConfig()).put(BrooklynWebConfig.SECURITY_PROVIDER_INSTANCE, delegate); mgmt.getScratchpad().put(BrooklynWebConfig.SECURITY_PROVIDER_INSTANCE, delegate); - - return delegate; } public static SecurityProvider loadProviderFromBundle(
