private void addService()

in src/main/java/org/apache/sling/auth/core/impl/AuthenticationRequirementsManager.java [367:390]


    private void addService(final ResourceMapper mapper, final ServiceReference<?> ref) {
        final String[] authReqPaths = Converters.standardConverter().convert(ref.getProperty(AuthConstants.AUTH_REQUIREMENTS)).to(String[].class);
        if ( authReqPaths.length > 0 ) {
            final Long id = (Long)ref.getProperty(Constants.SERVICE_ID);
            final Set<String> paths = buildPathsSet(mapper, authReqPaths);

            if ( !paths.isEmpty() ) {
                final List<AuthenticationRequirementHolder> authReqList = new ArrayList<>();
                for(final String authReq : paths) {
                    if (authReq == null || authReq.isEmpty()) {
                        logger.warn("Ignoring null/empty path while adding auth requirements for service {}", id);
                        continue;
                    }
                    authReqList.add(AuthenticationRequirementHolder.fromConfig(authReq, ref));
                }

                // keep original
                regProps.put(id, paths);
                registerService(authReqList);
                props.put(id, authReqList);
                logger.debug("Added auth requirements for service {} : {}", id, paths);
            }
        }
    }