I'm a bit late to the party, but I don't see an explicit mention of
actually creating the configuration. Adding a property to the @Component
doesn't create a configuration - it just supplies a default value in the
Map provided to the activate method if one isn't defined in a configuration.

To create a configuration use the web or ssh console, or create the file
no.priv.bang.authservice.config.cfg in /etc.

On Thu, 6 Feb 2025 at 20:02, Steinar Bang <[email protected]> wrote:

> >>>>> Jean-Baptiste Onofré <[email protected]>:
>
> > Hi Steinar
> > By default, SCR use the componentName as configuration PID.
> > However, you can pass the configurationPid to the component and so
> > several components can share the same configurationPid.
>
> Thanks!
>
> So far I've tried this:
> @Component(service=UserManagementService.class, immediate=true,
> configurationPid="no.priv.bang.authservice.config", property= {
> "excessiveFailedLoginLimit:Integer=3" } )
> public class UserManagementServiceProvider implements
> UserManagementService {
>
>     @Activate
>     public void activate(Map<String, Object> config) {
>         excessiveFailedLoginLimit = (int)
> config.get("excessiveFailedLoginLimit");
>     }
>
> and this:
> @Component( service=Realm.class, immediate=true,
> configurationPid="no.priv.bang.authservice.config" )
> public class AuthserviceDbRealm extends JdbcRealm {
>
>     @Activate
>     public void activate(Map<String, Object> config) {
>
> And UserManagementService.activate() receives excessiveFailedLoginLimit
> in its map, while AuthserviceDbRealm.activate() does not receive
> excessiveFailedLoginLimit in its map.
>
> I guess I could get a value in AuthserviceDbRealm.activate by setting a
> property argumenet to @Component there as well...?
>
> But setting the default two places does sort of defeat the purpose (I
> would like to set the default in a single place and use config to
> override config for both components).
>
>

Reply via email to