Commit Graph

271 Commits

Author SHA1 Message Date
Joe Grandja b5abb99908 ClaimAccessor.getClaimAsString() checks null claim value
Fixes gh-5608
2018-07-30 15:31:41 -04:00
Joe Grandja e243f93eed Default to server_error when OAuth2Error.errorCode is null
Fixes gh-5594
2018-07-30 13:20:58 -04:00
Rob Winch aea861e2f9 Fix Imports
Issue: gh-5599
2018-07-30 12:15:53 -05:00
Rob Winch a01dc3a5f6 WebFlux Handles Undefined State Parameter
Currently if a state exists, but an undefined state parameter is provided
a NullPointerException occurs.

This commit handles the null value.

Fixes: gh-5599
2018-07-30 12:02:42 -05:00
Rob Winch 2056b3440f Add ServerBearerTokenAuthenticationConverter
Issue: gh-5605
2018-07-30 11:39:40 -05:00
Rob Winch 4f417f01a7 BearerTokenServerAuthenticationEntryPoint
Issue: gh-5605
2018-07-30 11:39:34 -05:00
Rob Winch da73242d60 Add JwtReactiveAuthenticationManager
Issue: gh-5605
2018-07-30 11:39:28 -05:00
Rob Winch b8308c9ae0 Extract JwtConverter
Issue: gh-5605
2018-07-30 11:37:56 -05:00
Rob Winch f3c9cce56d Rename to WebClientAuthorizationCodeTokenResponseClient
Rename NimbusReactiveAUthorizationCodeTokenResponseClient to
WebClientReactiveAuthorizationCodeTokenResponseClient

Fixes: gh-5529
2018-07-26 15:14:11 -05:00
Rob Winch 1c8a931e33 Rename to OidcAuthorizationCodeReactiveAuthenticationManager
Renamed OidcReactiveAuthenticationManager to
OidcAuthorizationCodeReactiveAuthenticationManager since it only handles
authorization code flow.

Fixes: gh-5530
2018-07-26 15:14:11 -05:00
Joe Grandja 2c1c2c78c3 Add HttpServletResponse param to removeAuthorizationRequest
Fixes gh-5313
2018-07-26 14:15:56 -04:00
Johnny Lim 887db71333 Fix typo (#5580) 2018-07-26 10:04:21 -04:00
mhyeon.lee ba29b363fc Fix OAuth2AuthorizationRequestRedirectWebFilter baseurl exclude querystring
To create redirect_uri in OAuth2AuthorizationRequestRedirectWebFilter,
queryParam is included in the current request-based baseUrl.
So when binding to the redirectUriTemplate,
the wrong type of redirect_uri may be created.

Fixed: gh-5520
2018-07-23 15:42:15 -04:00
Joe Grandja 36cbdfe013 Fix NPE when null Authentication in authorization_code grant
Fixes gh-5560
2018-07-23 12:28:48 -04:00
Rob Winch 88975dad41 ServletOAuth2AuthorizedClientExchangeFilterFunction handles null authorized client
Issue: gh-5545
2018-07-22 12:01:42 -07:00
Rob Winch 67dd3f16e9 Add static methods for ServletOAuth2AuthorizedClientExchangeFilterFunction
This will allow us to break up
ServletOAuth2AuthorizedClientExchangeFilterFunction into multiple
components if we decide to later.

Issue: gh-5545
2018-07-20 11:48:20 -05:00
Rob Winch 9ababf4168 Rename to ServerOAuth2AuthorizedClientExchangeFilterFunction
Rename OAuth2AuthorizedClientExchangeFilterFunction to
ServerOAuth2AuthorizedClientExchangeFilterFunction->

Issue: gh-5386
2018-07-20 11:48:19 -05:00
Rob Winch 1b79bbed7f Add ServletOAuth2AuthorizedClientExchangeFilterFunction
Fixes: gh-5545
2018-07-20 11:48:19 -05:00
mhyeon.lee 3c461b704c Add AuthenticationMethod type
This section defines three methods of sending bearer access tokens
in resource requests to resource servers.
Clients MUST NOT use more than
one method to transmit the token in each request.

RFC6750 Section 2 Authenticated Requests
https://tools.ietf.org/html/rfc6750#section-2

Add AuthenticationMethod in ClientRegistration UserInfoEndpoint.

Add AuthenticationMethod for OAuth2UserService to get User.

To support the use of the POST method.
https://tools.ietf.org/html/rfc6750#section-2.2

gh-5500
2018-07-20 11:32:51 -04:00
Joe Grandja 9a144d742e Use OAuth2AuthorizedClientRepository in filters and resolver
Fixes gh-5544
2018-07-19 22:57:10 -04:00
mhyeon.lee 3f8e69211f Fix OAuth2 ClientRegistration scope can be null
Allows scope of OAuth2 ClientRegistration to be null.

- The scope setting in the RFC document is defined as Optional.
https://tools.ietf.org/html/rfc6749#section-4.1.1

    > scope:  OPTIONAL.
    > The scope of the access request as described by Section 3.3.

- When the client omits the scope parameter,
validation is determined by the authorization server.
https://tools.ietf.org/html/rfc6749#section-3.3

    > If the client omits the scope parameter when requesting
   authorization, the authorization server MUST either process the
   request using a pre-defined default value or fail the request
   indicating an invalid scope.  The authorization server SHOULD
   document its scope requirements and default value (if defined).

Fixes gh-5494
2018-07-18 16:17:14 -04:00
mhyeon.lee 191a4760f9 Fix DefaultOAuth2AuthorizationRequestResolver baseUrl excludes queryParams
To create redirect_uri in DefaultOAuth2AuthorizationRequestResolver,
queryParam is included in the current request-based baseUrl.
So when binding to the redirectUriTemplate,
the wrong type of redirect_uri may be created.

Fixes gh-5520
2018-07-17 12:00:01 -04:00
Rob Winch 981d35a92c Add ClientRegistration.Builder.registrationId
Fixes: gh-5527
2018-07-17 01:27:39 -05: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
Rob Winch d595098823 Rename @TransientAuthentication to @Transient
It is quite likely we will need to prevent certain Exceptions from being
saved or from triggering a saved request. When we add support for this,
we can now leverage @Transient vs creating a new annotation.

Issue: gh-5481
2018-07-16 11:31:10 -05:00
Josh Cummings 40ccdb93f7 Resource Server Jwt Support
Introducing initial support for Jwt-Encoded Bearer Token authorization
with remote JWK set signature verification.

High-level features include:

- Accepting bearer tokens as headers and form or query parameters
- Verifying signatures from a remote Jwk set

And:

- A DSL for easy configuration
- A sample to demonstrate usage

Fixes: gh-5128
Fixes: gh-5125
Fixes: gh-5121
Fixes: gh-5130
Fixes: gh-5226
Fixes: gh-5237
2018-07-16 10:40:46 -05: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
Joe Grandja 371221d729 Support anonymous Principal for OAuth2AuthorizedClient
Fixes gh-5064
2018-07-16 10:15:41 -05:00
Joe Grandja 779597af2a Add support for custom authorization request parameters
Fixes gh-4911
2018-07-16 09:39:06 -05:00
mhyeon.lee 1d920680bf Enhance OAuth2AccessToken to be serializable
Change the TokenType to Serializable
so that the OAuth2AccessToken can be serialized.
(org.springframework.security.oauth2.core.OAuth2AccessToken.TokenType)

Fixes gh-5492
2018-07-13 11:36:11 -04: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
Rob Winch f7dc76de5f Fix OAuth2BodyExtractorsTests for JDK9
Issue: gh-5475
2018-07-02 16:29:07 -05:00
Rob Winch ba489af354 Fix OAuth2AuthorizedClientExchangeFilterFunctionTests on JDK9
Issue: gh-4371
2018-07-02 16:16:16 -05:00
Rob Winch 127a32bd81 Fix checkstyle OAuth2AuthorizedClientExchangeFilterFunctionTests
Issue: gh-4371
2018-07-02 15:47:24 -05:00
Rob Winch 73689ecfd7 Fix Imports of OAuth2AccessTokenResponse
Issue: gh-5474
2018-07-02 15:46:33 -05:00
Rob Winch 0116c65c0e OAuth2AuthorizedClientExchangeFilterFunction Refresh Support 2018-07-02 14:14:17 -05:00
Rob Winch 1f1fb1a801 Add MockExchangeFunction getResponse
This allows setting up the mock

Issue: gh-5386
2018-07-02 12:43:00 -05:00
Rob Winch 0910e04bdf MockExchangeFunction Support Multiple Requests
Issue: gh-5386
2018-07-02 12:42:54 -05:00
Rob Winch e27e1cd637 Add OAuth2AccessTokenResponseBodyExtractor
This externalizes converting a OAuth2AccessTokenResponse from a
ReactiveHttpInputMessage.

Fixes: gh-5475
2018-07-02 12:41:44 -05:00
Rob Winch ab61732e17 Add OAuth2AccessTokenResponse.withResponse
Add ability to build a new OAuth2AccessTokenResponse from another
OAuth2AccessTokenResponse.

Fixes: gh-5474
2018-07-02 12:37:45 -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
Joe Grandja d32aa3c6d6 Validate sub claim in UserInfo Response
Fixes gh-5447
2018-06-25 16:44:04 -04: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 d521d5e066 Add OidcReactiveAuthenticationManager
Fixes: gh-5330
2018-06-18 16:08:07 -05:00
Rob Winch f7a2a41241 Add OidcReactiveOAuth2UserService
Issue: gh-5330
2018-06-18 16:08:07 -05:00
Rob Winch 5ed319b11a Add NimbusReactiveJwtDecoder
Issue: gh-5330
2018-06-18 16:08:07 -05:00