deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject deltaspike git commit: DELTASPIKE-1250 adding documentation for encryption
Date Tue, 23 May 2017 17:51:17 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master d1cc650d6 -> 98d4c2ab2


DELTASPIKE-1250 adding documentation for encryption


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/98d4c2ab
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/98d4c2ab
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/98d4c2ab

Branch: refs/heads/master
Commit: 98d4c2ab2ea2ce15cfe60c637a3792c3843b49f4
Parents: d1cc650
Author: Mark Struberg <struberg@apache.org>
Authored: Tue May 23 19:50:57 2017 +0200
Committer: Mark Struberg <struberg@apache.org>
Committed: Tue May 23 19:50:57 2017 +0200

----------------------------------------------------------------------
 .../src/main/asciidoc/configuration.adoc        | 27 ++++++++++++++++----
 documentation/src/main/asciidoc/core.adoc       |  4 +++
 2 files changed, 26 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/98d4c2ab/documentation/src/main/asciidoc/configuration.adoc
----------------------------------------------------------------------
diff --git a/documentation/src/main/asciidoc/configuration.adoc b/documentation/src/main/asciidoc/configuration.adoc
index 15a7473..3d955cd 100644
--- a/documentation/src/main/asciidoc/configuration.adoc
+++ b/documentation/src/main/asciidoc/configuration.adoc
@@ -589,12 +589,22 @@ Once some filters are provided, all operations of ConfigResolver return
filtered
 -------------------------------------------------------------
 public class DecryptingConfigFilter implements ConfigFilter
 {
+    private DefaultCipherService ciperSvc = new DefaultCipherService();
+    private String masterSalt = "someApplicationMasterSalt";
+
     @Override
     public String filterValue(String key, String value)
     {
-        if (key.contains("encrypted"))
+        if (key.contains("password"))
         {
-            return decrypt(value);
+            try
+            {
+                return cipherSvc.decrypt(value, masterSalt);
+            }
+            catch (Exception e)
+            {
+                return value;
+            }
         }
         return value;
     }
@@ -602,11 +612,18 @@ public class DecryptingConfigFilter implements ConfigFilter
     @Override
     public String filterValueForLog(String key, String value)
     {
-        return "<value encrypted>";
+        if (key.contains("password"))
+        {
+            return "***************";
+        }
+
+        return value;
     }
 }
 -------------------------------------------------------------
 
+For more information about the `CipherService` please see the <<encryption#, Encryption>>
section.
+
 Since 1.8.0 you can also decorate a CDI `ConfigFilter` with `@Filter` and it will
-be added to DeltaSpike configuration *once the CDI container is started* (it means
-you can't use this source in an `Extension`).
+be added to DeltaSpike configuration *once the CDI container is started* (Note that this
means
+you can't use this ConfigFilter in a CDI `Extension`).

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/98d4c2ab/documentation/src/main/asciidoc/core.adoc
----------------------------------------------------------------------
diff --git a/documentation/src/main/asciidoc/core.adoc b/documentation/src/main/asciidoc/core.adoc
index 6d43d0d..4da3c9f 100644
--- a/documentation/src/main/asciidoc/core.adoc
+++ b/documentation/src/main/asciidoc/core.adoc
@@ -22,6 +22,10 @@ mechanisms. Configuration can be overridden just by dropping a JAR into
the clas
 
 Detailed documentation is available on a separate page: <<configuration.adoc#,Configuration>>.
 
+== DeltaSpike CipherService
+
+Apache DeltaSpike also provides an <<encryption#, Encryption>> mechanism for
handling secret values within your application.
+
 === Internal configuration
 
 The functionality of DeltaSpike itself and its modules is adjustable using the same mechanism.
There are two main


Mime
View raw message