566 Commits

Author SHA1 Message Date
lhazlewood
db339704e5
Custom empty claims
Closes #858.

Custom claims can now be empty again (which was the behavior for <= 0.11.5).
2023-10-14 16:59:35 -07:00
lhazlewood
59c9df1231
Released 0.12.2 (#856)
* Released 0.12.2
* [maven-release-plugin] prepare release 0.12.2
* [maven-release-plugin] prepare for next development iteration
2023-10-05 22:43:35 -07:00
lhazlewood
a7d3d3197c
854 jdk17 visibility (#855)
* Closes #854.

- Replaced `ByteArrayInputStream` reflection with new `BytesInputStream` implementation. The reflection is what required `--add-opens java.base/java.io=jjwt.api` on JDK 17+.
- Refactored `KeysBridge` to perform our own key length logic instead of delegating to `sun.security.util.KeyUtil`.  The reflection is what required `--add-opens java.base/sun.security.util=jjwt.api` on JDK 17+
- Removed `AddOpens.java` due to above refactoring (no longer needed).
- Returned a test-only `--add-opens` for `sun.security.util` for 3 test cases (added to `test.addOpens` maven property)
2023-10-05 22:13:57 -07:00
lhazlewood
fad6e2737d
Released 0.12.1
* Released 0.12.1

* [maven-release-plugin] prepare release 0.12.1

* [maven-release-plugin] prepare for next development iteration
2023-10-04 20:08:53 -07:00
lhazlewood
1625067b85
Closes #849 (#852)
- enabled reflective access to `java.io.ByteArrayInputStream` and `sun.misc.security.KeyUtil` on JDK 17+
- Minor refactor to ServicesTest to avoid the need for PowerMock
2023-10-04 19:39:39 -07:00
lhazlewood
44cd5523e8
Update README.md
fixed leading slash typo error
2023-10-03 13:38:49 -07:00
lhazlewood
0c3040922a
0.12.0 staging complete (#847)
* replaced JJWT_RELEASE_VERSION placeholders with 0.12.0

* [maven-release-plugin] prepare release 0.12.0

* [maven-release-plugin] prepare for next development iteration
2023-10-03 13:27:28 -07:00
lhazlewood
b411b19b92
key byte array cleanup as necessary (#846) 2023-10-03 12:27:12 -07:00
lhazlewood
e78f3f511f
JwtParser.parse* method renames (#845)
* Closes #834

- Deprecated JwtParser parseContentJwt, parseClaimsJwt, parseContentJws and parseClaimsJws in favor of parseUnprotectedContent, parseUnprotectedClaims, parseSignedContent, and parseSignedClaims

- Renamed the not-yet-released JwtParser parseContentJwe and parseClaimsJwe to parseEncryptedContent and parseEncryptedClaims

- Renamed the not-yet-released JwtParser overloaded unencoded payload parseContentJws and parseClaimsJws methods to parseSignedContent and parseSignedClaims

- Deprecated JwtHandler and JwtHandlerAdapter in favor of JwtVisitor and SupportedJwtVisitor
2023-10-03 10:40:06 -07:00
Brian Demers
3b529ac640 Update maven wrapper
Latest version has an option to remove the need for `MavenWrapperDownloader.java`
2023-10-02 11:13:58 -04:00
lhazlewood
05717d0a18
Expanded Parser method argument support (#844)
Closes #328

- Ensured Parser worked with CharSequence, InputStream and Reader, not just String
- Changed Deserializer#deserialize(InputStream) to deserialize(Reader) 
- JwtParser now extends from Parser to support these additional methods.
- Changed remaining JwtParser.parse* methods to accept CharSequence arguments instead of String args.
2023-09-30 11:46:41 -07:00
lhazlewood
36a6e1383b
README cleanup based on latest API (#843) 2023-09-29 16:00:40 -07:00
lhazlewood
854bb8944c
Builder NestedCollection support (#841)
- Added Conjunctor, CollectionMutator, and NestedCollection
- Added JwkBuilder#operations() NestedCollection builder and removed #operation(KeyOperation) and #operations(Collection<KeyOperation>)
- KeyOperationPolicyBuilder now extends CollectionMutator

- Replaced ProtectedHeaderMutator#critical* methods with critical() NestedCollection

- Replaced JwtParserBuilder#critical* methods with critical() NestedCollection

- Replaced ClaimsMutator#audience* methods with audience() AudienceCollection

- Replaced JwtParserBuilder#add* methods with new collection builder methods: enc(), key(), sig() and zip()
2023-09-29 13:42:36 -07:00
lhazlewood
20b2fa9d50
Name cleanup (#840)
- Renamed X509Mutator#x509CertificateSha1Thumbprint to x509Sha1Thumbprint
- Renamed X509Mutator#x509CertificateSha256Thumbprint to x509Sha256Thumbprint
- Renamed X509Builder#withX509Sha1Thumbprint to x509Sha1Thumbprint
- Renamed X509Builder#withX509Sha256Thumbprint to x509Sha256Thumbprint
- Renamed X509Builder#x509CertificateChain to x509Chain
- Renamed X509Accessor#getX509CertificateChain to getX509Chain
- Renamed X509Accessor#getX509CertificateSha1Thumbprint getX509Sha1Thumbprint
- Renamed X509Accessor#getX509CertificateSha256Thumbprint to getX509Sha256Thumbprint

- Renamed JwtParserBuilder#enableUnsecured() to unsecured()
- Renamed JwtParserBuilder#enableUnsecuredDecompression() to unsecuredDecompression()

- Renamed KeyOperationPolicyBuilder#allowUnrelated(boolean) to unrelated() (removed boolean argument also to be consistent with JwtParserBuilder#unsecured())
2023-09-27 18:36:55 -07:00
lhazlewood
b687ca5c72
Replace String/byte[] with (N)IO streams (#838)
Closes #837 

Replaced raw `String` and `byte[]` usages with `CharSequence`, `InputStream`/`OutputStream` and `CharBuffer`/`ByteBuffer` concepts where possible to eliminate unnecessary creation of intermediate byte arrays and/or temporary Strings.

-----
- Changed TokenizedJwt and TokenizedJwe interfaces and implementations to return CharSequences instead of Strings to avoid creating new Strings on the heap
- Changed internal Base64 implementation to work with a CharSequence instead of a raw char[] to reduce need to create new arrays on the heap
- Changed Base64Decoder generics signature from Decoder<String,byte[]> to Decoder<CharSequence,byte[]>
- Decoders.BASE64 and Decoders.BASE64URL now reflect Decoder<CharSequence,byte[]>
- Changed Strings#utf8 implementation to accept a CharSequence instead of a String
- Added new Strings#wrap to wrap a CharSequence into a CharBuffer if necessary
- Renamed not-yet-released JwtBuilder#serializer method with JwtBuilder#json
- Renamed not-yet-released JwtParserBuilder#deserializer method with JwtParserBuilder#json

-----
- Moved JwtDeserializer from io.jsonwebtoken.impl to io.jsonwebtoken.impl.io package, created two new subclass implementations for use with Jwks and JwkSets
- Renamed JwtDeserializer to JsonObjectDeserializer that defaults to throwing MalformedJwtException.  Added two subclasses, JwkDeserializer and JwkSetDeserializer that throws JWK and JWK Set-specific exceptions.

-----
Changed ParserBuilder#deserializer method name to ParserBuilder#jsonReader

-----
Removed all usages of Serializer#serialize and Deserializer#deserialize except for deprecated implementations.  All other usages now use InputStream/OutputStream concepts

-----
Added Jwks#json and Jwks#UNSAFE_JSON for assistance in serializing JWKs to JSON (test cases, README examples, etc)

-----
- Ensured Encoder and CompressionAlgorithm supported streams instead of just byte arrays
- Copied over necessary (Apache-licensed) code from Apache commons-codec to obtain Base64OutputStream and Base64InputStream capability for efficient encoding during compact JWT creation.  Hopefully this is temporary and we can strip out most if not all of this and modify our existing Base64.java class for simpler support since we have many less use cases than what commons-codec supports.  All implementations are now in the `impl` module only.

-----
Converted all DigestAlgorithms to utilize an InputStream for data instead of byte[]

-----
- Added JwtBuilder InputStream payload support: added JwtBuilder#content(InputStream), JwtBuilder#content(InputStream, String contentType), JwtBuilder#content(String, String contentType)
- Added CountingInputStream as a way to check and assert that b64/unencoded payload InputStreams cannot be empty.

------
Renamed Encoder/Decoder and CompressionAlgorithm 'wrap' methods to encode/decode/compress/decompress for better readability and to make clearer the intent of the method. Also to avoid name/text/search collisions with 'wrap' references.

-----
Renamed new JwtBuilder#encoder and JwtParserBuilder#decoder methods to JwtBuilder#b64Url and JwtParserBuilder#b64Url for shorter method chains

-----
- Updated AeadAlgorithm and its AeadRequest/AeadResult concepts to utilize Input/Output Streams
- Renamed InitializationVectorSupplier to IvSupplier (was verbose, and it's a new interface, and it's not commonly referenced in the API, so the extra verbosity isn't needed)
2023-09-27 16:31:11 -07:00
Brian Demers
7fcd652aea Add Java 21 to CI matrix build
* Update groovy patch version to support Java 21.

NOTE: This adds a Maven profile that ups the source/target version to Java 8, but ONLY when building with 21+
2023-09-25 16:25:30 -04:00
Brian Demers
7805e08bff ServiceLoaders are now cached.
The first ServiceLoaders found when looking up a class will be cached. This cache can be reset by calling `Services.reload()`, to help
facilitate testing or instances where a classpaths are dynamically changed at runtime.

Fixes: #752
2023-09-18 11:36:25 -04:00
lhazlewood
a920163be4
Closes #773 (#835)
Fixed exception message per recommendation.
2023-09-16 18:49:43 -07:00
lhazlewood
a2b65763e9
Closes #816 (#836)
Closes #816

Fixed exception message per recommendation.

Also updated expiration message to be clearer/intuitive.
2023-09-16 18:47:33 -07:00
Micah Silverman
e9df2da272
Added snyk open-source ratings badges to readme (#688)
* Added snyk open-source ratings badges to readme
2023-09-16 15:32:31 -07:00
lhazlewood
fa1e32bf86
Updated Unencoded Payload Option Table of Contents (#833) 2023-09-16 14:06:50 -07:00
lhazlewood
34aa33421f
RFC7797 implementation (#832)
Closes #515

[RFC 7797)(https://www.rfc-editor.org/rfc/rfc7797.html) support.

JwsHeader:
- Added new JwtHeader#isPayloadEncoded() to check for `b64` in crit values and as parameter value.

JwtBuilder:
- Added new #content(String) method for non-detached unencoded payloads
- Added new #encodePayload(boolean) method to disable payload Base64URL-encoding

JwtParserBuilder:
- Added new #critical(String) convenience method to append to the crit set

JwtParser:
- Added new #parseContentJws(String, byte[]) method to allow supplying detached payloads for signature verification at parse time
- Added new #parseClaimsJws(String, byte[]) method to allow supplying detached serialized JSON claims for signature verification at parse time

- Added all backing implementations and test cases to 100% coverage
- Added RFC7797Test class for bulk of this RFC's tests so they don't get 'lost' in the already-too-large JwtsTest class
- README.md documentation added in JWS section
- CHANGELOG.md updated
2023-09-16 13:56:13 -07:00
lhazlewood
bf5d81cbb5
Ensured various builder collection argument methods were semantically the same (append operations, not one append, one replace) (#830) 2023-09-15 09:42:44 -07:00
lhazlewood
8cb59d760b
Support crit header enforcement (#829)
* Ensured Jwts.header() and Jwts.builder().header() builders sanitized crit header values per https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.11 and https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.13 before creating the final Header instance
* Modified DefaultJweHeader#isCandidate and DefaultProtectedHeader#isCandidate method implementations to only look for required fields (it's a candidate for respective type creation if and only if those values are set).
* Ensured Jwts.parser() enforced the same rules in https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.11
* Added RFC7515AppendixETest to reflect the test case(s) for conforming implementations (i.e. JJWT) in https://www.rfc-editor.org/rfc/rfc7515.html#appendix-E
2023-09-14 17:58:50 -07:00
lhazlewood
2ca3580fd9
impl: Renamed all Field* concepts to Parameter* to match JOSE RFCs taxonomy (#828)
Closes #817
2023-09-13 13:22:44 -07:00
lhazlewood
d0d80fe849
UnsupportedKeyException changes (#826)
* Changed usages of UnsupportedKeyException to only those where a given key is actually not understood.  Cases where the key is not valid for the current use case was changed to throw InvalidKeyException instead to better indicate validation failure.

* Changed superclass of UnsupportedKeyException to KeyException instead of InvalidKeyException (unsupported means 'I don't know what this key is', whereas InvalidKeyExceptions mean 'the key failed validation'). An unsupported key is not necessarily invalid, it just means we don't know how to handle it.
2023-09-13 11:54:04 -07:00
lhazlewood
b55f26175c
JWK .equals and .hashCode (#823)
* Adjusted JWK .equals implementations to only account for kty value and material fields (two JWKs are equal if their type and key material are equal, regardless of other public parameters and/or custom name/value pairs).

* Adjusted JWK .hashCode implementation to pre-cache its value based on JwkThumpbrint fields since JWKs are immutable
2023-09-12 20:38:01 -07:00
lhazlewood
f60d560297
JwkSet support (#822)
* Added JwkSet, JwkSetBuilder, JwkSetParserBuilder interfaces w/ backing implementations
* Added Jwks#set and Jwks#setParser static factory methods
* Ensured JavaDoc and code coverage
2023-09-12 09:55:52 -07:00
lhazlewood
ffbe9477da
Audience claim string arrays (#819)
* Ensured `aud` claim is an array by default, but allows a single string value on creation for recipients that do not understand array values:
- ClaimsMutator#audience(String) now appends to the `aud` set, and may be called multiple times
- Added new ClaimsMutator#audience(Collection) method for setting/full replacement
- Added new ClaimsMutator#audienceSingle for setting/full replacement of single string value
- Marked ClaimsMutator#audienceSingle as Deprecated (even though it's not!) to discourage its use when possible.
2023-09-09 11:11:25 -07:00
lhazlewood
524429ea3f
Upgraded org.json dependency to latest available version 20230618 (#818) 2023-09-08 16:19:42 -07:00
lhazlewood
847ad1332c
New KeyOperation, KeyOperationPolicy and builder concepts (#814)
* Added new KeyOperation and KeyOperationBuilder concepts
Changed Jwk#getOperations and JwkBuilder#operations from methods that accepted and returned Strings to use new KeyOperation instances
Added Jwks.OP#builder() method to create a KeyOperationBuilder

* Changed Jwks.OP#WRAP to WRAP_KEY and UNWRAP to UNWRAP_KEY to match RFC names

* Added new KeyOperationPolicy and KeyOperationPolicyBuilder concepts
Added Jwks.OP#policy() builder method to create a KeyOperationPolicyBuilder
Added JwkBuilder#operationPolicy and JwkParserBuilder#operationPolicy methods for configuring custom KeyOperationPolicy instances during JWK building and parsing, respectively.
2023-09-08 16:03:47 -07:00
lhazlewood
a6792d938f
Added regression tests for #365 (#812)
* Added regression tests for #365
* Removed default doDigest implementation from AbstractSecureDigestAlgorithm and put it in DefaultMacAlgorithm (where it should have been) since SignatureAlgorithms override it already
2023-09-05 18:29:55 -07:00
lhazlewood
d54be182dc
Added test case for #438 (#811)
* Added test case for https://github.com/jwtk/jjwt/issues/438
2023-09-05 15:34:56 -07:00
lhazlewood
26026d63cd
Upgrade BC to 1.76 (#810)
* Upgraded BC to 1.76
* Addressed Pkcs11Test that fails on Mac OS (arm64) with JDK 1.7 (x86_64)
* Updated README.md to show BC version 1.76
2023-09-05 14:29:17 -07:00
lhazlewood
8e0f740329
Enabled key-specific Provider support during JwtParser execution. (#809)
* Enabled key-specific Provider support during JwtParser execution. Usage patterns and documentation updated inn JwtParserBuilder#keyLocator and README.md.

* Updated Table of Contents with link to Key Locator key-specific Provider section

* Added Pkcs11Test test case that ensures explicit .provider calls for all JWS and JWE operations are not needed when the PKCS11 provider is installed in the JVM via Security.addProvider

* Removed unnecessary CryptoAlgorithm#nonPkcs11Provider method

* Ensured RSA key validation implementation is consistent with name/available-length validation checks in other SecureDigestAlgorithm implementations
2023-09-05 13:08:31 -07:00
lhazlewood
c3ff0bbf12
Updated README.md to reflect GitHub Discussions support. (#808) 2023-09-03 12:17:18 -07:00
lhazlewood
21e243c376
PKCS11 testing with SoftHSM2 (#805)
* Added impl/src/main/resources/io/jsonwebtoken/impl/security/genkeys script for reuse/simplicity and help in CI

* Updated tests reflecting updated test key material from genkeys script

* Fixed license headers for newly generated test key files

* Removed conditional check for X448 and X25519 certificate/chains now that we have signed certs for those test key files

* Added new impl/src/test/scripts/softhsm script with `configure` and `import` subcommands for working with SoftHSMv2, used locally and in CI

* Enabling PKCS11 keystore interaction on macos and linux (CI) via Pkcs11Test

* Added new AbstractCurve#contains method and leveraged that to clean up code considerably in EcdhKeyAlgorithm.java

* Updated softhsm script to ensure EC key import used the pkcs11-tool `--usage-derive` flag to allow testing PKCS11 keys with ECDH-ES key algorithms

* Renamed CryptoAlgorithm#generateKey to #generateCek to be more explicit in its purpose.

* Introduced new CryptoAlgorithm#nonPkcs11Provider to ensure PKCS11 provider won't be used when key material is required (i.e. for ephemeral key(pair) KeyAlgorithms).

* Ensured CryptoAlgorithm#generateCek ignored applying a PKCS11 provider since required key material wouldn't be available otherwise.

* Ensured DefaultJwtBuilder and DefaultJwtParser would use the provider for the KeyAlgorithm, but not for the AeadAlgorithm (unless using direct encryption)

* Consolidated unsigned byte array length calculation for non-negative integers (used in a few places) to a new Bytes#uintLength method. Refactored other classes to use this new method to eliminate code duplication

* Added tests for JWS MAC algorithms (HS256, HS384, HS512) with PKCS11 secret keys

* Explicitly prevented Password instances in DefaultMacAlgorithm

* Fixed the EdwardsCurve#keyBitLength implementation to accurately reflect RFC key sizes and not encoded byte array sizes.

* OptionalMethodInvoker now supports static invocations in addition to the existing instance invocation support.
2023-09-02 19:53:29 -07:00
lhazlewood
d6dac16042
Move EC curve utility functions (#803)
- Changed EC point multiplication montgomery ladder iteration to be a little faster (still has fixed number of operations of course)
- Moved Weierstrass calc/utility methods to ECCurve instead of AbstractEcJwkFactory
- Removed unnecessary Curves.java since StandardCurves is the preferred implementation
- Renamed CurvesTest to StandardCurvesTest
2023-08-27 16:56:15 -07:00
lhazlewood
095f446c37
- Ensured EdwardsCurve#findByKey checked encoded key length if possible (#802) 2023-08-27 08:18:12 -07:00
lhazlewood
eca568ec16
Consolidate BouncyCastle lookup/fallback logic to JcaTemplate (#798)
* Consolidating BouncyCastle lookup/fallback behavior to JcaTemplate to avoid complexity in Algorithm implementations

* Added JcaTemplate generateX509Certificate helper method to enable BC-fallback behavior if necessary

* Further reduced code dependencies on Providers class.  Now only used by JcaTemplate, JcaTemplateTest and ProvidersTest

* Removed Condition and Conditions concepts - no longer needed now that Providers.java no longer requires conditional loading
2023-08-24 11:56:23 -07:00
Dabeen Jeong
ed98f3d706
Replace duplicate code with global environment variable (#800) 2023-08-22 13:23:11 -07:00
Les Hazlewood
7bb97fac72 README.md fix (and associated JweReadmeTest) to ensure docs accurately reflected new Jwks.CRV references 2023-08-17 15:37:35 -07:00
lhazlewood
620cc5d97f
Made Curve and Jwks.CRV part of the public API (#797)
* Made Curve concept part of the public API for key generation, and added Jwks.CRV utility class to reference standard curves

- Ensured PS256, PS384, and PS512 pem-encoded test key files accurately represented the rsassa-pss algorithmId (OID) with appropriate hash/mgf1 properties.
- Removed Jwts.SIG#Ed25519 and Jwts.SIG#Ed448 since they were only there for key generation and those keys can now be generated via the Jwks.CRV#Ed25519 and Jwks.CRV#Ed448 references.
- Consolidated duplicate use/key_ops logic for checking sig/sign/verify between SecretJwkFactory and RsaPrivateJwkFactory into JwkContext.isSigUse()
- Ensured if JwkContext.isSigUse() is true, and a JWK (from values only) is RSA and RSASSA-PSS is available (JDK 11+ or BC enabled), that the JWK's generated RSAPublicKey and RSAPrivateKey use the RSASSA-PSS algorithm instead of just RSA.
- Enforced that RSASSA-PSS keys cannot be used for encryption in the RSA KeyAlgorithm implementation (would be a security risk otherwise).
- Enforced that RSA encryption keys cannot be used to create RSASSA-PSS digital signatures (but can verify them) ala the "robustness principle" (to reduce security exposure).
- Ensured README.md and JavaReadmeTest reflected Jwks.CRV usage for keypair generation.

* Added TestCertificates workaround for https://bugs.openjdk.org/browse/JDK-8242556

* Added JwtX509StringConverter workaround for https://bugs.openjdk.org/browse/JDK-8242556

* Added JwtX509StringConverter workaround for https://bugs.openjdk.org/browse/JDK-8242556

* Reverted to former RsaSignatureAlgorithm logic for PSS key validation (no prevention of rsaEncryption keys with PSS) as RFC 7520 test vectors show using a standard RSA key to compute a PSS signature in https://www.rfc-editor.org/rfc/rfc7520.html#section-4.2.1

* Ensured Jwk tests that used RSASSA-PSS keys (from openssl files) used the BC provider since RSASSA-PSS isn't available natively before JDK 11

* Restored TestCertificates logic needed to address JDK 11 bug during tests https://bugs.openjdk.org/browse/JDK-8213363 (fixed in JDK 12+)
2023-08-17 15:21:54 -07:00
lhazlewood
c142fb5c7a
Automatic compact cty header (#795)
Ensured header 'cty' raw value reflects a compact form but getContentType() return value reflects a normalized value per per https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.10
2023-08-09 12:20:10 -07:00
lhazlewood
7ed0b772ae
Builder setters (#794)
- Renamed Keys.forPassword to slightly cleaner/less verbose Keys.password
- Ensured ClaimsMutator extends MapMutator
- Ensured JwtBuilder verifyWith is overloaded and accepts only SecretKey and PublicKey instances
- Ensured JwtBuilder decryptWith is overloaded and accepts only SecretKey and PrivateKey instances
- Renamed JwtParserBuilder#enableUnsecuredJwts() to enableUnsecured() since any JWT or JWS without a header (or with an alg of none) are both considered 'unsecured', so the suffix was removed to avoid confusion.

- Renamed MapMutator `set` methods to `add` methods to avoid Java setter full replacement idiom confusion (as opposed to add/append)

- Removed MapMutator superinterface from ClaimsBuilder.  Generic map mutation methods on the JwtBuilder are a little confusing.
- Added JwtBuilder#claims() method that returns a Claims mutator with an and()  method to get back to the JwtBuilder

- Added a convenience JwtBuilder#claims(Map) method (modern builder-style name)
- Added a new JwtBuilder#encoder to eventually replace the now-deprecated JwtBuilder#base64UrlEncodeWith method
- Added a new JwtBuilder#serializer to eventually replace the now-deprecated JwtBuilder#serializeToJsonWith method

- Renamed JwtParserBuilder#base64UrlDecoder to just JwtParserBuilder#decoder
- Renamed JwtParserBuilder#jsonDeserializer to just JwtParserBuilder#deserializer
- Lots of README.md updates to reflect builder api name changes

- Renamed KeyBuilderSupplier#keyBuilder() to less verbose KeyBuilderSupplier#key()
- Renamed KeyPairBuilderSupplier#keyPairBuilder() to less verbose KeyPairBuilderSupplier#keyPair()

- Renamed ProtoJwkBuilder to DynamicJwkBuilder

- Renamed JwtBuilder.Header to JwtBuilder.BuilderHeader to avoid naming/import conflict with io.jsonwebtoken.Header
- Renamed JwtBuilder.Claims to JwtBuilder.BuilderClaims to avoid naming/import conflict with io.jsonwebtoken.Claims

- removed DynamicJwkBuilder chain methods with array arguments
- added generic DynamicJwkBuilder#keyPair(KeyPair) method
- added generic DynamicJwkBuilder#chain method

- Reintroduced deprecated Header mutation methods for a slightly easier transition to 0.12.0, will remove in next release

- Deprecated public String constants in Header.java and JwsHeader.java

- Documentation, JavaDoc and code example changes/formatting fixes and enhancements
2023-08-08 19:13:34 -07:00
tungj
db94dc7b79
Fix typo 'paylaod' -> 'payload' (#793) 2023-08-07 14:17:05 -07:00
lhazlewood
7376d160e0
Removing sonatype-lift config due to analysis terminating on 2023-08-12 per https://community.sonatype.com/t/sunset-notice-sonatype-lift/10940 (#792) 2023-08-04 16:55:30 -07:00
lhazlewood
12a4a2e859
Immutable jwtparser (#791)
* - JwtParser is now immutable (no mutation methods, `final` internal state, etc).
- Jwts.parser() has been changed to return a `JwtParserBuilder`, Jwts.parserBuilder() has been removed since it's now superfluous.
- LegacyServices.java has been deleted since DefaultJwtParser is no longer mutable (it was used in the parse() method. This logic is now only performed via the Services.java implementation used by the JwtParserBuilder).
- ImmutableJwtParser.java has been deleted since it was a wrapper around a mutable DefaultJwtParser implementation.  Now that DefaultJwtParser is immutable, ImmutableJwtParser.java is no longer necessary.
2023-08-04 16:42:35 -07:00
lhazlewood
529f04dd90
Immutables (#790)
* Jwts#header() and JwtBuilder#header() API cleanup

* added license headers, removed unused Conjunctor interface concept

* impl checkpoint for Registry-to-Map implementation change

* Jwts.SIG and Jwts.ENC conversion checkpoint (complete)

* Jwts.KEY and Jwks.HASH conversion checkpoint (complete)

* File header and Javadoc cleanup.  Removed unused SignatureRequest.java concept.

* Changed deprecated API usage in test case

* - Removed *Accessor concepts where possible, just using the *Header interfaces was sufficient
- KeyAlgorithm#getEncryptionKey now accepts a JweHeader that is mutable. Implementations can just use Map#put to modify the header state if desired.

* MapMutator method renaming to avoid odd conventions

* introduced ProtectedJwt concept and intermediate DefaultProtectedJwt implementation

* Removed all usages of CompressionCodecs.java in favor of a new Jwts.ZIP entry.
Renamed all Standard***AlgorithmsBridge to Standard***Algorithms

* CompressionCodec to CompressionAlgorithm transition (complete, code coverage 100%)
2023-08-04 12:35:33 -07:00
Ivan Matthew
992d75d0b4
Changed javadoc typos (#782)
Related issue #764 

EC256 > ES256
EC384 > ES384
EC512 > ES512
2023-05-19 14:15:32 -07:00