Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Spring Security OAuth2 support Authorization Code Flow with PKCE for browser (Angular) clients?

Browser applications auth used to be managed using the Implicit grant of the Authorization Server. I successfully implemented this using Spring Security Oauth.

This approach has several drawbacks:

  1. Refresh tokens are not supported, so when the token expires we need to reauthenticate with the Authorization server.
  2. This grant is not recommended due to its security concerns (see https://oauth.net/2/grant-types/implicit/ and https://datatracker.ietf.org/doc/html/draft-parecki-oauth-browser-based-apps-01).

Currently the recommended option is using Authorization code flow with PKCE for browser applications.

How could this be implemented in a Spring Boot Authorization Server with spring boot oauth?

like image 663
codependent Avatar asked Nov 30 '18 22:11

codependent


People also ask

Does spring security support PKCE?

As of Spring Security 5.7, PKCE is fully supported for both servlet and reactive flavored web applications. However, this feature is not enabled by default since not all identity providers support this extension yet.

What is Authorization Code flow with PKCE?

The Authorization Code Flow + PKCE is an OpenId Connect flow specifically designed to authenticate native or mobile application users. This flow is considered best practice when using Single Page Apps (SPA) or Mobile Apps. PKCE, pronounced “pixy” is an acronym for Proof Key for Code Exchange.

Does Google OAuth support PKCE?

Google supports the Proof Key for Code Exchange (PKCE) protocol to make the installed app flow more secure. A unique code verifier is created for every authorization request, and its transformed value, called "code_challenge", is sent to the authorization server to obtain the authorization code.

What is OAuth PKCE?

PKCE is an OAuth 2.0 security extension for public clients on mobile devices intended to avoid a malicious programme creeping into the same computer from intercepting the authorisation code. The RFC 7636 introduction discusses the mechanisms of such an attack.

Does spring security support PKCe and OAuth?

The latest version of Spring Security (5. 2. 1 as of this writing) supports OAuth 2. 0 and OpenID Connect natively. It supports PKCE for public clients. It does not yet support PKCE for confidential clients. There is a pull request (written by my colleague, Brian Demers) that is expected to be incorporated into the next release.

Does spring security support OAUTH and OpenID Connect?

The latest version of Spring Security (5.2.1 as of this writing) supports OAuth 2.0 and OpenID Connect natively. It supports PKCE for public clients. It does not yet support PKCE for confidential clients.

What is the PKCe for authorization code flow?

Given these situations, OAuth 2.0 provides a version of the Authorization Code Flow which makes use of a Proof Key for Code Exchange (PKCE) (defined in OAuth 2.0 RFC 7636 ).

What is the latest guidance for OAuth?

Last year, the developers submitted two drafts of important pieces of guidance for OAuth 2.0. OAuth 2.0 Security Best Current Practices gives advice for securing modern apps with OAuth 2.0, and OAuth 2.0 for Browser-Based Apps focuses specifically on web app best practices.


1 Answers

No, it does not yet support PKCE, though there is a ticket for it.

Note also that Spring Security's OAuth support is in a bit of a transition phase right now while it is migrated into Spring Security proper. Feel free to follow this feature matrix to see where progress is at.

UPDATE: Spring Authorization Server now supports this feature.

like image 64
jzheaux Avatar answered Sep 19 '22 21:09

jzheaux