Skip to content

[esh-authz2] Missing service references  #3

Description

@svilenvul

This was a strange one. I set up an OSGi runtime including several(I think two) AuthenticationProviders, but only one was injected into the DefaultAuthenticationManager.

What I did was to change the reference policy from static to dynamic, but I am not sure in this change:

@@ -63,7 +64,7 @@ public class DefaultAuthenticationManager implements AuthenticationManager {
         throw new AuthenticationException("Could not authenticate credentials " + credentials);
     }
 
-    @Reference(cardinality = ReferenceCardinality.MULTIPLE)
+    @Reference(cardinality = ReferenceCardinality.MULTIPLE, policy=ReferencePolicy.DYNAMIC)
     public void addAuthenticationProvider(AuthenticationProvider provider) {
         providers.add(provider);
     }

I had similar problem in the AuthenticationHandler:

@@ -135,7 +148,7 @@ public class AuthenticationHandler implements Handler {
         }
     }
 
-    @Reference(cardinality = ReferenceCardinality.OPTIONAL)
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
     public void setAuthneticationManager(AuthenticationManager authenticationManager) {
         this.authenticationManager = authenticationManager;
     }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions