Colm O hEigeartaigh created CXF-9286:
----------------------------------------
Summary: Remove ModelEncryptionSupport and the DefaultEncrypting
OAuth2 data providers
Key: CXF-9286
URL: https://issues.apache.org/jira/browse/CXF-9286
Project: CXF
Issue Type: Improvement
Reporter: Colm O hEigeartaigh
Assignee: Colm O hEigeartaigh
Fix For: 4.3.0
The {{cxf-rt-rs-security-oauth2}} module ships an older, home-grown way of
producing self-contained OAuth2 artifacts. {{ModelEncryptionSupport}}
serializes tokens, code grants and clients into a custom delimited string
format and encrypts the result with a secret key. Two data providers are built
on it:
*
{{org.apache.cxf.rs.security.oauth2.provider.DefaultEncryptingOAuthDataProvider}}
*
{{org.apache.cxf.rs.security.oauth2.grants.code.DefaultEncryptingCodeDataProvider}}
This mechanism predates CXF’s JOSE/JWT support and is no longer needed:
* Both providers keep issued tokens, refresh tokens, grants and clients in
in-memory sets for lookup and revocation. They don’t actually provide stateless
operation, and all state is lost on restart.
* Self-contained access tokens are better served by the standard JWT format
({{{}AbstractOAuthDataProvider#setUseJwtFormatForAccessTokens{}}}), and
persistent storage by the JPA and JCache providers.
* The custom string format is hard to maintain and to extend safely.
*Proposed changes for 4.3.0:*
# Remove
{{{}org.apache.cxf.rs.security.oauth2.utils.crypto.ModelEncryptionSupport{}}}.
# Remove {{DefaultEncryptingOAuthDataProvider}} and
{{{}DefaultEncryptingCodeDataProvider{}}}, along with their unit tests and test
helpers ({{{}EncryptingDataProvider{}}},
{{{}CodeGrantEncryptingDataProvider{}}}, and the related cases in
{{{}CryptoUtilsTest{}}}).
# Rework {{JoseSessionTokenProvider}} so it no longer depends on
{{{}ModelEncryptionSupport{}}}. It should carry the authorization redirection
state as a JWT claims set, signed and/or encrypted with the existing JWS/JWE
configuration. Its public setters and Spring/Blueprint configuration stay the
same. Only consent sessions in progress during the upgrade are affected.
# Add a migration note to the 4.3.0 migration guide.
*Migration:*
* Users of the {{DefaultEncrypting*}} providers should switch to
{{JPAOAuthDataProvider}} / {{JPACodeDataProvider}} or
{{JCacheOAuthDataProvider}} / {{{}JCacheCodeDataProvider{}}}. They can enable
{{useJwtFormatForAccessTokens}} if they want self-contained access tokens.
* Tokens issued by the removed providers are held in memory only, so there’s
no persisted data to migrate.
* Code calling {{ModelEncryptionSupport}} directly must be changed. Any
encrypted strings it has persisted itself won’t be readable after the upgrade.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)