cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXf-6133] Initial work for supporting Jose-specific exceptions, to be completed later on
Date Thu, 26 Mar 2015 11:04:01 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 27dd4216b -> d84a45645


[CXf-6133] Initial work for supporting Jose-specific exceptions, to be completed later on


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

Branch: refs/heads/3.0.x-fixes
Commit: d84a45645925046ddd6cd5b88459c2fcea550a3f
Parents: 27dd421
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Thu Mar 26 11:02:08 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Thu Mar 26 11:03:16 2015 +0000

----------------------------------------------------------------------
 .../cxf/rs/security/jose/JoseException.java     | 37 +++++++++++++++++++
 .../cxf/rs/security/jose/jwe/JweException.java  | 39 ++++++++++++++++++++
 .../jose/jws/AbstractJwsSignatureProvider.java  |  8 +++-
 .../cxf/rs/security/jose/jws/JwsException.java  | 39 ++++++++++++++++++++
 4 files changed, 122 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/d84a4564/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseException.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseException.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseException.java
new file mode 100644
index 0000000..79fbad2
--- /dev/null
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseException.java
@@ -0,0 +1,37 @@
+/**
+ * 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.cxf.rs.security.jose;
+
+public class JoseException extends RuntimeException {
+
+    private static final long serialVersionUID = 4118589816228511524L;
+    public JoseException() {
+        
+    }
+    public JoseException(String text) {
+        super(text);
+    }
+    public JoseException(Throwable cause) {
+        super(cause);
+    }
+    public JoseException(String text, Throwable cause) {
+        super(text, cause);
+    }
+    //Jose Error enum can be introduced too
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/d84a4564/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweException.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweException.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweException.java
new file mode 100644
index 0000000..8a6424e
--- /dev/null
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweException.java
@@ -0,0 +1,39 @@
+/**
+ * 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.cxf.rs.security.jose.jwe;
+
+import org.apache.cxf.rs.security.jose.JoseException;
+
+public class JweException extends JoseException {
+
+    private static final long serialVersionUID = 4118589816228511524L;
+    public JweException() {
+        
+    }
+    public JweException(String text) {
+        super(text);
+    }
+    public JweException(Throwable cause) {
+        super(cause);
+    }
+    public JweException(String text, Throwable cause) {
+        super(text, cause);
+    }
+    // Jwe Error enum can be introduced too
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/d84a4564/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/AbstractJwsSignatureProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/AbstractJwsSignatureProvider.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/AbstractJwsSignatureProvider.java
index dd2defc..4b77c47 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/AbstractJwsSignatureProvider.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/AbstractJwsSignatureProvider.java
@@ -18,11 +18,15 @@
  */
 package org.apache.cxf.rs.security.jose.jws;
 
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.rs.security.jose.JoseHeaders;
 import org.apache.cxf.rs.security.jose.jwa.SignatureAlgorithm;
 
 
 public abstract class AbstractJwsSignatureProvider implements JwsSignatureProvider {
+    protected static final Logger LOG = LogUtils.getL7dLogger(AbstractJwsSignatureProvider.class);
     private SignatureAlgorithm algorithm;
     
     protected AbstractJwsSignatureProvider(SignatureAlgorithm algo) {
@@ -60,8 +64,10 @@ public abstract class AbstractJwsSignatureProvider implements JwsSignatureProvid
     protected abstract JwsSignature doCreateJwsSignature(JoseHeaders headers);
     
     protected void checkAlgorithm(String algo) {
+        String error = "Invalid signature algorithm";
         if (algo == null) {
-            throw new SecurityException();
+            LOG.warning(error + ":" + algo);
+            throw new JwsException(error);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/d84a4564/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsException.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsException.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsException.java
new file mode 100644
index 0000000..5073c7d
--- /dev/null
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsException.java
@@ -0,0 +1,39 @@
+/**
+ * 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.cxf.rs.security.jose.jws;
+
+import org.apache.cxf.rs.security.jose.JoseException;
+
+public class JwsException extends JoseException {
+
+    private static final long serialVersionUID = 4118589816228511524L;
+    public JwsException() {
+        
+    }
+    public JwsException(String text) {
+        super(text);
+    }
+    public JwsException(Throwable cause) {
+        super(cause);
+    }
+    public JwsException(String text, Throwable cause) {
+        super(text, cause);
+    }
+    // Jws Error enum can be introduced too
+}


Mime
View raw message