You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oltu.apache.org by as...@apache.org on 2016/02/19 08:22:44 UTC
svn commit: r1731189 - in
/oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io:
JWEConstant.java JWEConstants.java JWEHeaderParser.java JWEHeaderWriter.java
Author: asanso
Date: Fri Feb 19 07:22:44 2016
New Revision: 1731189
URL: http://svn.apache.org/viewvc?rev=1731189&view=rev
Log:
OLTU-80 - Implement JWE support for JWT
Added:
oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEConstants.java
oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEHeaderParser.java
oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEHeaderWriter.java
Removed:
oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEConstant.java
Added: oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEConstants.java
URL: http://svn.apache.org/viewvc/oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEConstants.java?rev=1731189&view=auto
==============================================================================
--- oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEConstants.java (added)
+++ oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEConstants.java Fri Feb 19 07:22:44 2016
@@ -0,0 +1,84 @@
+/*
+ * 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.oltu.jose.jwe.io;
+
+interface JWEConstants {
+
+ // header defined in the JWE specification
+ // https://tools.ietf.org/html/rfc7516
+
+ /**
+ * The {@code alg} JWE Header key.
+ */
+ public static final String ALGORITHM = "alg";
+
+ /**
+ * The {@code enc} JWE Header key.
+ */
+ public static final String ENCRYPTION_ALGORITHM = "enc";
+
+ /**
+ * The {@code zip} JWE Header key.
+ */
+ public static final String COMPRESSION = "zip";
+
+ /**
+ * The {@code jku} JWE Header key.
+ */
+ public static final String JWK_SET_URL = "jku";
+
+ /**
+ * The {@code jwk} JWE Header key.
+ */
+ public static final String JSON_WEB_KEY = "jwk";
+
+ /**
+ * The {@code kid} JWE Header key.
+ */
+ public static final String KEY_ID = "kid";
+
+ /**
+ * The {@code x5u} JWE Header key.
+ */
+ public static final String X509_URL = "x5u";
+
+ /**
+ * The {@code x5t} JWE Header key.
+ */
+ public static final String X509_CERTIFICATE_THUMBPRINT = "x5t";
+
+ /**
+ * The {@code x5c} JWE Header key.
+ */
+ public static final String X509_CERTIFICATE_CHAIN = "x5c";
+
+ /**
+ * The {@code typ} JWE Header key.
+ */
+ public static final String TYPE = "typ";
+
+ /**
+ * The {@code cty} JWE Header key.
+ */
+ public static final String CONTENT_TYPE = "cty";
+
+ /**
+ * The {@code crit} JWE Header key.
+ */
+ public static final String CRITICAL = "crit";
+
+}
Added: oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEHeaderParser.java
URL: http://svn.apache.org/viewvc/oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEHeaderParser.java?rev=1731189&view=auto
==============================================================================
--- oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEHeaderParser.java (added)
+++ oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEHeaderParser.java Fri Feb 19 07:22:44 2016
@@ -0,0 +1,21 @@
+/*
+ * 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.oltu.jose.jwe.io;
+
+final class JWEHeaderParser {
+
+}
Added: oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEHeaderWriter.java
URL: http://svn.apache.org/viewvc/oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEHeaderWriter.java?rev=1731189&view=auto
==============================================================================
--- oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEHeaderWriter.java (added)
+++ oltu/trunk/jose/jwe/src/main/java/org/apache/oltu/jose/jwe/io/JWEHeaderWriter.java Fri Feb 19 07:22:44 2016
@@ -0,0 +1,40 @@
+/*
+ * 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.oltu.jose.jwe.io;
+
+import org.apache.oltu.commons.json.CustomizableEntityWriter;
+import org.apache.oltu.jose.jwe.Header;
+
+public final class JWEHeaderWriter extends CustomizableEntityWriter<Header> implements JWEConstants {
+
+ @Override
+ protected void handleProperties(Header header) {
+ set(ALGORITHM, header.getAlgorithm());
+ set(ENCRYPTION_ALGORITHM, header.getEncryptionAlgorithm());
+ set(COMPRESSION, header.getCompressionAlgorithm());
+ set(JWK_SET_URL, header.getJwkSetUrl());
+ set(JSON_WEB_KEY, header.getJsonWebKey());
+ set(X509_URL, header.getX509url());
+ set(X509_CERTIFICATE_THUMBPRINT, header.getX509CertificateThumbprint());
+ set(X509_CERTIFICATE_CHAIN, header.getX509CertificateChain());
+ set(KEY_ID, header.getKeyId());
+ set(TYPE, header.getType());
+ set(CONTENT_TYPE, header.getContentType());
+ set(CRITICAL, header.getCritical());
+ }
+
+}