Spring Security OAuth2 — Client Authentication Issue

DZone 's Guide to

Spring Security OAuth2 — Client Authentication Issue

A bug recently surfaced concerning Spring Security, OAuth 2, and the ability for a user to obtain an access token in an inappropriate manner. Read on to find out details and for the fix.

· Java Zone ·
Free Resource

Issue #808 was recently reported that allowed a user to authenticate as a client and obtain an access token via the client_credentials or password grant flow.

This unique scenario occurs when a client and user have the same identifier (clientId and username). The user’s credentials are used for client authentication during a client_credentials or password grant flow and is successful in obtaining an access token with the authorities of the client.

The Fix

This bug has been fixed in 1ed986a and released in 2.0.11.RELEASE.

If you’re using Java-based configuration, please update to 2.0.11.RELEASE.

However, if you’re using XML-based configuration, please take the following actions:

  • Update to 2.0.11.RELEASE
  • Look at this JUnit test and it’s associated XML configuration to ensure the AuthenticationManager for client authentication and the AuthenticationManager for user authentication is setup the same in your configuration.
  • As a precautionary step, make sure your XML configuration is NOT setup the same as in this JUnit test and associated XML configuration as it demonstrates the original issue.

Thank you for reporting this issue Michael Pridemore and Ben Kiefer.

authentication, client, junit, oauth2, spring, spring security, xml

Published at DZone with permission of Joe Grandja , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}