Commit Graph

143 Commits

Author SHA1 Message Date
Adrian Javorski dd45a49f02 Update JwtTimestampValidator.java
Changed MaxClockSkew variable to clockSkew to simplify the name.

Fixes gh-6380
2019-01-14 10:33:38 -07:00
Johnny Lim c94f13a971 Polish tests 2019-01-08 11:16:22 -06:00
Joe Grandja 8f4f52edb9 Support configurable JwtDecoder for IdToken verification
Fixes gh-5717
2018-12-21 09:24:55 -06:00
Josh Cummings 566bc6a6e1
Test OpenID Discovery with Trailing Slash
Fixes gh-6234
2018-12-05 10:54:30 -07:00
Josh Cummings 2a8233d035
Remove PowerMock from oauth2-core and oauth2-jose
Issue: gh-6025
2018-11-20 14:02:10 -07:00
Josh Cummings 1ea73e7d8e Jwt Decoder Local Key Configuration
Adds support for configuring Resource Server DSL with a local public
key.

Fixes: gh-5131
2018-11-16 13:07:19 -06:00
Josh Cummings d28e32b000 NimbusJwtDecoder Builder
A Builder to simply common construction patterns for NimbusJwtDecoder

Issue: gh-6010
2018-11-14 15:53:47 -06:00
Josh Cummings fbcf48cea0 Low-level Nimbus Jwt Decoder
Introduces a JwtDecoder which takes a raw Nimbus JWTProcessor
configuration.

Fixes: gh-5648
2018-11-14 15:53:47 -06:00
Josh Cummings ae74f22e30 Reactive Jwt Claim Set Converter Support
Exposes setClaimSetConverter on NimbusReactiveJwtDecoder, lining it up
with the same support on NimbusJwtDecoder.

Fixes: gh-6015
2018-11-13 15:31:08 -06:00
Josh Cummings 19649db9ce
Leave Issuer As String
Since StringOrURI is a valid issuer, MappedJwtClaimSetConverter and
JwtIssuerValidator no longer assume it.

Issue: gh-6073
2018-11-13 11:39:15 -07:00
Josh Cummings c70b65c5df
Favor URL.toExternalForm
Converts URLs to Strings before comparing them. Uses toString(),
which delegates to toExternalForm().

Fixes: gh-6073
2018-11-13 08:20:18 -07:00
Josh Cummings a32d19ec7d
Polish NimbusReactiveJwtDecoderTests
Issue: gh-5650
2018-11-12 15:04:00 -07:00
Joe Grandja 9565e90b6e Remove oauth2-oidc-sdk dependency from oauth2-jose module
Fixes gh-5891
2018-09-20 15:20:11 -04:00
Josh Cummings 9e0f171d47 Jwt Claim Mapping
This introduces a hook for users to customize standard Jwt Claim
values in cases where the JWT issuer isn't spec compliant or where the
user needs to add or remove claims.

Fixes: gh-5223
2018-09-07 09:48:26 -05:00
Josh Cummings 59cdfc7d6e ReactiveJwtDecoder via OIDC Provider Configuration
A reactive static builder for constructing and configuring a
ReactiveJwtDecoder via an issuer that supports the OIDC Provider
Configuration spec.

Fixes: gh-5649
2018-08-21 15:09:18 -05:00
Josh Cummings 01443e35b4 Reactive Jwt Validation
This allows a user to customize the Jwt validation steps that
NimbusReactiveJwtDecoder will take for each Jwt.

Fixes: gh-5650
2018-08-21 15:06:05 -05:00
Josh Cummings b11e9ed317
Fix Javadoc Typo
NimbusReactiveJwtDecoder incorrectly referred in its class-level doc
as being an implementation of JwtDecoder. This has been corrected to
say ReactiveJwtDecoder.

Fixes: gh-5711
2018-08-21 12:21:23 -06:00
Josh Cummings 2e620a26de Auto-configure JwtDecoder via OpenId Configuration
Adding JwtDecoders#fromOidcIssuerLocation which takes an issuer
and derives from it the jwk set uri via a call to
.well-known/openid-configuration

Fixes: gh-5523
2018-08-17 11:20:26 -05:00
Rob Winch 06df562d61 Polish JwtValidators
The current name of createDelegatingJwtValidator is not intuitive. The
name implies it is just creating a DelegatingOAuth2TokenValidator with
no mention that JwtTimestampValidator is being added.

To resolve this, the arguments have been removed and only
JwtTimestampValidator is added. User's needing additional validators can
add the result of this method to DelegatingOAuth2TokenValidator along with
the additional validators they wish to use. The method name has been
renamed to createDefault which now accurately reflects what is created.
There is no need to have JwtValidator at the end of the method since
the method is located in JwtValidators.

The commit also adds createDefaultWithIssuer for creating with a specific issuer.

Issue: gh-5133
2018-08-16 13:21:07 -05:00
Josh Cummings 7c524aa0c8 Jwt Claim Validation
This introduces OAuth2TokenValidator which allows the customization of
validation steps that need to be performing when decoding a string
token to a Jwt.

At this point, two validators, JwtTimestampValidator and
JwtIssuerValidator, are available for use.

Fixes: gh-5133
2018-08-16 13:19:26 -05:00
Joe Grandja 16fe1c5b52 Expose RestOperations in NimbusJwtDecoderJwkSupport
Fixes gh-5603
2018-08-08 14:49:46 -04:00
Josh Cummings becff23df1
Reliable Error State Tests - Nimbus
A test against the Nimbus library was relying on specific messaging
from Nimbus as well as the JDK, making it brittle.

Now, it simply relies on the messaging that we control.

Issue: gh-4887
2018-07-16 14:46:42 -06:00
Josh Cummings 6e67c0dcea Remap Nimbus JSON Parsing Errors
When Nimbus fails to parse either a JWK response or a JWT response,
the error message contains information that either should or cannot be
included in a Bearer Token response.

For example, if the response from a JWK endpoint is invalid JSON, then
Nimbus will send the entire response from the authentication server in
the resulting exception message.

This commit captures these exceptions and removes the parsing detail,
replacing it with more generic information about the nature of the
error.

Fixes: gh-5517
2018-07-16 10:40:46 -05:00
Rob Winch a5ae714ed5 NimbusReactiveJwtDecoder propagates errors looking up keys
Fixes: gh-5490
2018-07-06 16:39:59 -05:00
Josh Cummings 998d1a064b Close Nimbus Information Leak
This commit captures and remaps the exception that Nimbus throws
when a PlainJWT is presented to it.

While the surrounding classes are likely only used today by the
oauth2Login flow, since they are public, we'll patch them at this
point for anyone who may be using them directly.

Fixes: gh-5457
2018-07-03 10:28:31 -05:00
Josh Cummings d7ebe5be86
Rename createJwkSet method typo
Actually, it is creating a claims set, just a typo.

Issue: gh-5330
2018-06-28 11:31:21 -06:00
Rob Winch 8ef4a5ba92 Add NimbusReactiveJwtDecoder RSAPublicKey Support
Fixes: gh-5460
2018-06-25 21:30:49 -05:00
Rob Winch 81350ca3c3 Add NimbusJwkReactiveJwtDecoderTests
Issue: gh-5330
2018-06-25 12:13:08 -05:00
Rob Winch 7b406e89e4 Fixes in decoder 2018-06-25 10:08:13 -05:00
Rob Winch a5f7713d9f adding a test 2018-06-25 10:03:53 -05:00
Rob Winch 5ed319b11a Add NimbusReactiveJwtDecoder
Issue: gh-5330
2018-06-18 16:08:07 -05:00
Rob Winch 0d23aad911 Add ReactiveRemoteJWKSource
Issue: gh-5330
2018-06-18 16:08:07 -05:00
Rob Winch 7898ce2ded Add JWKContextJWKSource
Issue: gh-5330
2018-06-18 16:08:07 -05:00
Rob Winch aa0ea4a8eb Add JWKContext
Issue: gh-5330
2018-06-18 16:06:32 -05:00
Rob Winch 923e23d05b Add JWKSelectorFactory
Issue: gh-5330
2018-06-18 16:06:26 -05:00
Joe Grandja d8f91e4261 Fix NPE with exp claim in NimbusJwtDecoderJwkSupport
Fixes gh-5168
2018-04-04 07:58:32 -04:00
Joe Grandja 2bd31c96ed ClaimAccessor.getClaimAsInstant() converts Long or Date
Fixes gh-5191, Fixes gh-5192
2018-04-03 21:14:25 -04:00
Joe Grandja 6b24aaf6f5 Add javadoc for spring-security-oauth2-jose
Fixes gh-4885
2018-01-23 21:27:47 -05:00
Johnny Lim 57353d18e5 Use diamond type 2017-12-21 15:09:00 -06:00
Joe Grandja 63e2db72ea Add tests to oauth2-jose
Fixes gh-4806
2017-11-10 17:09:48 -05:00
Joe Grandja d435f149eb Polish spring-security-oauth2-jose
Fixes gh-4755
2017-10-30 13:09:40 -04:00
Joe Grandja 9b670882b7 Rename SecurityToken -> AbstractOAuth2Token
Fixes gh-4646
2017-10-25 10:29:34 -04:00
Joe Grandja f0c9f85292 spring-security-jwt-jose -> spring-security-oauth2-jose
Fixes gh-4595
2017-10-23 09:04:01 -04:00