rombert commented on code in PR #13:
URL: 
https://github.com/apache/sling-org-apache-sling-commons-crypto/pull/13#discussion_r4072219157


##########
src/main/java/org/apache/sling/commons/crypto/internal/OsgiConfigurationPasswordProviderConfiguration.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.commons.crypto.internal;
+
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.AttributeType;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
+
+@ObjectClassDefinition(
+    name = "Apache Sling Commons Crypto OSGi Configuration Password Provider",
+    description = "Provides passwords from OSGi configurations."
+)
+@interface OsgiConfigurationPasswordProviderConfiguration {
+
+    @AttributeDefinition(
+        name = "Names",
+        description = "Names of this service",
+        required = false
+    )
+    String[] names() default {};
+
+    @AttributeDefinition(
+        type = AttributeType.PASSWORD,
+        name = "Password",
+        description = "The actual password. For security reasons only use with 
interpolation to reference external values via pattern \"$[secret:...]\" as 
outlined in 
https://github.com/apache/felix-dev/blob/master/configadmin-plugins/interpolation/README.md,
 e.g. \"$[secret:sling.crypto.password]\"."
+    )
+    String password();
+

Review Comment:
   CF0001: Please make this a private configuration property, otherwise the 
visibility is too wide.
   
   DS publishes component properties whose names do not start with `.` as 
properties of the registered service, so the resolved plaintext secret is 
currently available to other bundles through 
`ServiceReference.getProperty("password")`. 
   
   `AttributeType.PASSWORD` only affects UI representation, in our case the Web 
Console.
   
   The canonical representation is:
   
   ```java
   String _password();
   ```
   
   References:
   - [OSGi Configuration Admin 1.6, §104.4.3, Configuration 
Properties](https://docs.osgi.org/specification/osgi.cmpn/8.0.0/service.cm.html#service.cm-properties)
   - [OSGi Configuration Admin 1.6, §104.4.4, Property 
Propagation](https://docs.osgi.org/specification/osgi.cmpn/8.0.0/service.cm.html#service.cm-property.propagation)
   - [OSGi Declarative Services 1.5, §112.6.1, Service 
Properties](https://docs.osgi.org/specification/osgi.cmpn/8.0.0/service.component.html#service.component-service.properties)
   - [OSGi Declarative Services 1.5, §112.8.2.1, Component Property 
Mapping](https://docs.osgi.org/specification/osgi.cmpn/8.0.0/service.component.html#service.component-component.property.mapping)
   - [OSGi Metatype 1.4, §105.9.1, ObjectClassDefinition 
Annotation](https://docs.osgi.org/specification/osgi.cmpn/8.0.0/service.metatype.html#service.metatype-objectclassdefinition.annotation)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to