Commit Graph

83 Commits

Author SHA1 Message Date
Josh Cummings 6eadf7b140
Unlock dependencies for 5.3.0.RELEASE
This reverts commit 147d7dadd7.
2020-03-04 12:02:48 -07:00
Josh Cummings 147d7dadd7
Lock dependencies for 5.3.0.RELEASE 2020-03-04 10:28:39 -07:00
Roman Matiushchenko 9d66f2ccce polish gh-7996
Make defensive collection copy as Collections.unmodifiableCollection
does not protect from the source collection direct modification.
Use Mono#map instead of Mono#flatMap as it allocates less.
Use less operators to reduce allocations.
Use lambda parameter instead of outer method parameter
in authenticationManagers#computeIfAbsent()
to make it non capturing so it could be cached by JVM.
Propagate cause for InvalidBearerTokenException.
2020-02-27 09:29:43 -07:00
Roman Matiushchenko 04e671fb4d Instantiate exceptions lazily
Add lazy Exception instantiation to reduce allocations

Fixes gh-7995
2020-02-27 09:29:43 -07:00
Joe Grandja fa73b1397a Add missing @FunctionalInterface in oauth2 modules
Fixes gh-8020
2020-02-24 11:53:30 -05:00
Josh Cummings a90e579350 Add JwtIssuerReactiveAuthenticationManagerResolver
Fixes gh-7857
2020-02-06 13:45:13 -07:00
Eleftheria Stein 84b8a5abd7 Unlock dependencies for next development version
This reverts commit 064616f1ef.
2020-02-05 15:53:04 +01:00
Eleftheria Stein 064616f1ef Lock dependencies for 5.3.0.RC1 2020-02-05 10:20:05 +01:00
Josh Cummings 209c81d65d
Add BadOpaqueTokenException
Updated NimbusOpaqueTokenIntrospector and
NimbusReactiveOpaqueTokenIntrospector to throw.
Updated OpaqueTokenAuthenticationProvider and
OpaqueTokenReactiveAuthenticationManager to catch.

Fixes gh-7902
2020-02-04 17:33:08 -07:00
Josh Cummings 0c3754c811
Add BadJwtException
Updated NimbusJwtDecoder and NimbusReactiveJwtDecoder to throw.
Updated JwtAuthenticationProvider and JwtReactiveAuthenticationManager
to catch.

Fixes gh-7885
2020-02-04 17:33:08 -07:00
Josh Cummings fbdecdafb8
Add Mapping to Invalid Bearer Token
Fixes gh-7793
2020-02-04 17:33:08 -07:00
Josh Cummings 3e07b35611
Polish Bearer Token Error Handling
Issue gh-7822
Issue gh-7823
2020-02-03 17:54:39 -07:00
Josh Cummings 1b15f74f57
Add InvalidBearerTokenException
Fixes gh-7822
2020-02-03 17:54:39 -07:00
Josh Cummings 7b2fcd17f5
Add BearerTokenErrors
Fixes gh-7823
2020-02-03 17:54:33 -07:00
Eleftheria Stein fcc6457bef Unlock dependencies for next development version
This reverts commit 93acf8f0f1.
2020-01-08 22:15:17 +01:00
Eleftheria Stein 93acf8f0f1 Lock dependencies for 5.3.0.M1 2020-01-08 19:41:10 +01:00
Josh Cummings de87675f6d Add JwtIssuerAuthenticationManagerResolver
Fixes gh-7724
2020-01-07 23:30:42 -07:00
Rob Winch 65981444f1 Use Version Ranges
Fixes gh-7788
2020-01-06 14:46:48 -06:00
Josh Cummings ed02ef9773
Add Test for Malformed Scope
Fixes gh-7563
2019-10-28 16:55:56 -06:00
Josh Cummings 387f765595
Catch Malformed BearerTokenError Descriptions
Fixes gh-7549
2019-10-28 12:30:27 -06:00
Josh Cummings 33ba292fed
Resource Server w/ SecurityReactorContextSubscriber
Fixes gh-7423
2019-09-27 11:01:04 -06:00
Rob Winch 00f8991fac Merge Remove Redudant Throws
Fixes gh-7301
2019-09-19 11:04:53 -05:00
Josh Cummings 05caf3d8fb
Use Jwt.Builder
Fixes gh-7443
2019-09-16 14:00:25 -06:00
Josh Cummings 101e0a21a8 Bearer WebClient Filter Authentication Propagation
Fixes: gh-7418
2019-09-11 16:27:21 +01:00
Josh Cummings 099d49aa40 Simplify currentAuthentication() 2019-09-04 15:33:41 -06:00
Josh Cummings 40ff837713 Polish Server|ServletBearerExchangeFilterFunction
Fixes gh-7353
2019-09-04 15:33:41 -06:00
Josh Cummings d7f7e9d4b7 Add Jwt to BearerTokenAuthentication Converter
Fixes gh-7346
2019-09-03 15:58:05 -06:00
Josh Cummings 068f4f0147 Polish Opaque Token
Use OAuth2AuthenticatedPrincipal
Use BearerTokenAuthentication
Update names to reflect more generic approach.

Fixes gh-7344
Fixes gh-7345
2019-09-03 15:58:05 -06:00
Josh Cummings c019507770 Add BearerTokenAuthentication
Fixes gh-7343
2019-09-03 15:58:05 -06:00
Josh Cummings f350988285 Add Servlet and ServerBearerExchangeFilterFunction
Fixes gh-5334
Fixes gh-7284
2019-09-03 15:29:06 -06:00
kostya05983 f6c650db47
Replace Streams with Loops
First version of replacing streams

fix wwwAuthenticate and codestyle

fix errors in implementation to pass tests

Fix review notes

Remove uneccessary final to align with cb

Short circuit way to authorize

Simplify error message, make code readably

Return error while duplicate key found

Delete check for duplicate, checkstyle issues

Return duplicate error

Fixes gh-7154
2019-09-02 15:30:48 -06:00
Lars Grefer 95511331fa fix checkstyle 2019-08-26 22:42:26 +02:00
watsta 2c2e8e5f24 Remove internal Optional usage in favor of null checks
Issue gh-7155
2019-08-26 09:27:40 -04:00
Lars Grefer 34dd5fea30 Remove redundant throws clauses
Removes exceptions that are declared in a method's signature but never thrown by the method itself or its implementations/derivatives.
2019-08-23 01:03:54 +02:00
Rob Winch a377581951 Fix WebClient Memory Leaks
WebClient exchange requires that the body is consumed. Before this commit
there were places where an Exception was thrown without consuming the body
if the status was not successful. There was also the potential for the
statusCode invocation to throw an Exception of the status code was not
defined which would cause a leak.

This commit ensures that before the Exception is thrown the body is
consumed. It also uses the http status in a way that will ensure an
Exception is not thrown.

Fixes gh-7293
2019-08-21 12:46:11 -05:00
Andreas Falk 766c4434d4 Improve test coverage of JwtGrantedAuthoritiesConverter
Some negative test cases were missing. Added these to have
full test coverage for JwtGrantedAuthoritiesConverter.
2019-08-19 21:14:07 -04:00
Andreas Falk 0a058c973a Add setter for authorities claim name in JwtGrantedAuthoritiesConverter
Prior to this change authorities are always mapped using well known
claim names ('scope' or 'scp'). To change this default behaviour the
converter had to be replaced completely with a custom one.
This commit adds an additional setter to configure a custom
claim name like e.g. 'roles'. Without specifying a custom claim name
the default claims to be used still remains to the well known ones.
This way the authorities can be mapped according to customized
token claims.

Fixes gh-7100
2019-08-19 21:14:07 -04:00
Andreas Falk b45e57cc40 Add setter for authority prefix in JwtGrantedAuthoritiesConverter
Prior to this change mapped authorities are always prefixed
with default value 'SCOPE_'. To change this default behaviour the
converter had to be replaced completely with a custom one.
This commit adds an additional setter to configure a custom
authority prefix like e.g. 'ROLE_'. Without specifying a custom prefix
the default prefix still remains 'SCOPE_'.
This way existing authorization checks using the standard 'ROLE_'
prefix can be reused without lots of effort.

Fixes gh-7101
2019-08-14 11:25:42 -04:00
Josh Cummings 4ed197e515 Rename OAuth2TokenIntrospectionClient
Renamed to OpaqueTokenIntrospector

Fixes gh-7245
2019-08-12 18:05:28 -04:00
Lars Grefer ff1070df36 remove redundant modifiers found by checkstyle 2019-08-10 00:18:56 +02:00
Josh Cummings d843818e48
Polish JwtGrantedAuthoritiesConverter
Rework the implementation so that it is clearer that authorities are
derived from a single claim.

Issue: gh-6273
2019-08-02 14:54:04 -06:00
Eddú Meléndez 50adb6abcb Fix javadoc 2019-07-31 15:36:30 -04:00
matkocsis e584207a85 Loggin Fix for printing the full stack trace, spring-projects/spring-security#7110 2019-07-23 16:48:37 -05:00
Édouard Hue e8dd1325fd Fixed misleading OAuth2 error messages
Error messages sent by BearerTokenAccessDeniedHandler included
information about the scopes of the rejected token instead of
the scopes required by the resource.
* Removal of token scopes from error_description attribute.
* Removal of scope attribute from WWW-Authenticate response header.

Fixes gh-7089
2019-07-18 07:01:33 -04:00
Clement Ng cd54808718 Update Opaque Token Sample and tests
Issue: gh-6498
2019-07-02 07:45:56 -06:00
Clement Ng 491da9db03 Added OAuth2TokenAttributes to wrap attributes
To simplify access to OAuth 2.0 token attributes

Fixes gh-6498
2019-07-02 07:45:56 -06:00
Thomas Vitale f9747e6591 BearerTokenAuthenticationFilter exposes AuthenticationFailureHandler
Make BearerTokenAuthenticationFilter expose an AuthenticationFailureHandler which, by default, invokes the AuthenticationEntryPoint set in the filter.

Fixes gh-7009
2019-07-01 05:24:29 -06:00
Rob Winch 6f5a443175 ServerBearerTokenAuthenticationConverter Handles Empty Tokens
Previously ServerBearerTokenAuthenticationConverter would throw an
IllegalArgumentException when the access token in a URI was empty String.
It also incorrectly provided HttpStatus.BAD_REQUEST for an empty String
access token in the headers.

This changes ServerBearerTokenAuthenticationConverter to consistently
throw a OAuth2AuthenticationException with an HttpStatus.UNAUTHORIZED

Fixes gh-7011
2019-06-24 13:57:29 -06:00
Tadaya Tsuyukubo 3cb0975860 Accept Converter in ReactiveJwtAuthenticationConverterAdapter
Currently, "ReactiveJwtAuthenticationConverterAdapter" takes
"JwtAuthenticationConverter" as its constructor argument. However,
this limits the usage of this adapter.
In this commit, widen the constructor to take "Converter<Jwt,
AbstractAuthenticationToken>" and allow this adapter to be used by
generic converters.
2019-06-10 10:47:43 -06:00
Florian Aumeier 9fe8949883 Add @transient to OAuth2IntrospectionAuthenticationToken
fixes gh-6829
2019-05-29 08:42:09 -06:00