All notable changes to this project will be documented in this file.
- [java-security] Make HybridTokenFactory more failure tolerant
- [spring-xsuaa-test] Prefills "ext_atr" "enhancer" with XSUAA
- [all]
- commons-io 2.6 --> 2.8.0
- org.apache.httpcomponents » httpclient 4.5.9 --> 4.5.13
- spring.core.version 5.3.2 --> 5.3.3
- spring.boot.version 2.4.1 --> 2.4.2
- [java-security-test]
- org.eclipse.jetty 9.4.35.v20201120 --> 9.4.36.v20210114
- [token-client]
- caffeine 2.8.6 --> 2.8.8
- org.json 20200518 --> 20201115
- [spring-xsuaa]
- caffeine 2.8.6 --> 2.8.8
- reactor-core 3.3.7.RELEASE --> 3.4.2
- log4j-to-slf4j 2.13.3 --> 2.14.0
- [java-api]
AccessToken
exposes thegetSubaccountId()
method. Further information about the usage ofgetSubaccountId()
andgetZoneId()
can be read here. - [java-api] [java-security] allows hybrid token creation via
Token.create(String encodedToken)
. The feature is available when using token authenticator. - [samples/sap-java-buildpack-api-usage] uses SAP Java Buildpack BoM.
- [token-client]
UserTokenFlow
enhances request withX-zid
header that corresponds to zone id.
- [java-security]
- HOTFIX for
2.8.1
version. - Beta release of ias2xsuaa token exchange. Further information can be found here.
- HOTFIX for
- [spring-xsuaa]
- Beta release of ias2xsuaa token exchange. Further information can be found here.
- Replaces dependencies to JSON Parser of
net.minidev
withorg.json
(fixes #414). - The following dependencies were updated:
- spring.boot.version 2.3.5.RELEASE --> 2.4.1
- spring.core.version 5.2.10.RELEASE --> 5.3.2
- spring.security.version 5.3.5.RELEASE --> 5.4.2
- [java-security]
getClientId()
method was added toToken
interface.getClientId()
method should be used instead ofgetClaimAsString(TokenClaims.XSUAA.CLIENT_ID)
.TokenClaims.XSUAA.CLIENT_ID
is deprecated.- Supports IAS token validation.
IAS_SERVICE_NAME
has not be provided any longer. You can find a sample here.
- [java-security-test] In case you like to overwrite the client id using
JwtGenerator
usingwithClaimValue()
orwithClaimValues()
method, it's recommended to set theazp
claim instead usingwithClaimValue(TokenClaims.AUTHORIZATION_PARTY, "T000310")
. - [spring-xsuaa]
getClientId()
method implementation ofToken
interface has been changed. Usingazp
and as fallbackaud
andcid
claims to obtain client id.
⚠️ backward incompatible change: usage of deprecated org.springframework.security.oauth:spring-security-oauth2 dependency inOAuth2AuthenticationConverter
was removed.OAuth2AuthenticationConverter.convert()
method return type has changed fromorg.springframework.security.oauth2.provider.OAuth2Authentication
toorg.springframework.security.oauth2.server.resource.authentication.BearerTokenAuthentication
- Migration tips
- when necessary, org.springframework.security.oauth:spring-security-oauth2 dependency need to be provided explicitly
OAuth2WebSecurityExpressionHandler()
won't work in conjunction withOAuth2AuthenticationConverter
, as it expectsOAuth2Authentication
class instead ofBearerTokenAuthentication
when deriving authorization claims. UsehasAuthority()
orhasAnyAuthority()
instead of explicitly definedexpressionHandler(new OAuth2WebSecurityExpressionHandler())
andaccess()
expression for authorized requests.
- Migration tips
- The following dependency was removed:
- org.springframework.security.oauth:spring-security-oauth2
- The following dependencies were updated:
- spring.boot.version 2.3.4.RELEASE --> 2.3.5.RELEASE
- spring.core.version 5.2.9.RELEASE --> 5.2.10.RELEASE
- spring.security.version 5.3.4.RELEASE --> 5.3.5.RELEASE
- caffeine.version 2.8.2 --> 2.8.6
- [java-security-test] Supports JUnit 5 Tests with
XsuaaExtension
,IasExtension
andSecurityTestExtension
as documented here. - [spring-xsuaa-starter] Upgrade Spring versions:
- spring.boot.version: 2.3.1.RELEASE --> 2.3.4.RELEASE
- spring.core.version: 5.2.8.RELEASE --> 5.2.9.RELEASE
- The following dependencies were updated:
- Jetty 9.4.24.v20191120 --> 9.4.31.v20200723
- javax.servlet-api.version 3.0.1 --> 3.1.0
- Apache HTTP client 4.5.8 --> 4.5.9
- Wiremock 2.25.1 --> 2.27.2
- [java-security] Does not fail in case of Xsuaa services of type:
apiacess
(#382).
- [spring-xsuaa] Update Spring versions
- spring.core.version: 5.2.7.RELEASE --> 5.2.8.RELEASE
- spring.security.version: 5.3.3.RELEASE --> 5.3.4.RELEASE
- [java-security-test]
SecurityTest
andSecurityTestRule
provides a better support for integration tests with a mockserver. It is now possible to upload the configuration and the token from a json file. Take our integration tests as a sample java-security-it. - [java-security]
DefaultJsonObject.getAsStringList(propertyName)
parses the JSON object for a given property and returns aString
list. This works also in case the property is not a JSON array but a JSON String. - [java-security-it] New integration test project. Existing integration tests have been restructured and moved here. Additionally, JWT token validation performance tests have been added for java-security and spring-xsuaa.
- Fixes
ClientCredentialsTokenFlow.scopes()
andUserTokenFlow.scopes()
to support multiple scopes. The scope form parameter has to provide a space-delimited list (and not comma-delimited list). - [java-security] Improve compatibility of
SAPOfflineTokenServicesCloud
- There was incompatibility in the implementation of
SAPOfflineTokenServicesCloud
that caused theremoteUser
of theHttpServletRequest
to always return the client id of the XSUAA service binding. This was changed so that it now works like in the old implementation. This means that theremoteUser
now returns either theuser_name
claim of the token for user tokens or the value of the client idcid
claim of the token for all other tokens (e.g. client tokens).
- There was incompatibility in the implementation of
- [java-api]
AcessToken
providesgetAttributeFromClaimAsString(String claimName, String attributeName)
to access for exampleext_attr
values such assubaccountid
getAttributeFromClaimAsStringList(String claimName, String attributeName)
to access for examplexs.user.attributes
values such ascustom_role
- [java-security] provide debug logs for failing token validation, see troubleshoot.
- [java-security-test] Fixed default value for jku token header to
http://localhost/token_keys
- [samples] Upgraded approuter version to "^8.2.0"
- [spring-xsuaa-starter] Upgrade Spring versions:
- spring.boot.version: 2.3.0.RELEASE --> 2.3.1.RELEASE
- spring.core.version: 5.2.6.RELEASE --> 5.2.7.RELEASE
- spring.security.version: 5.3.2.RELEASE --> 5.3.3.RELEASE
- spring-security-oauth2.version: 2.4.1.RELEASE --> 2.5.0.RELEASE
- [java-security] Audience Validation validates to true when the derived
client_id
of broker-clone token matches the trusted client. This is relevant to support tokens of grant typeuser_token
that contains no scopes.
- [java-security]
- Audience Validation is skipped when
client_id
of token exactly matches the trusted client. This is relevant to support tokens of grant typeuser_token
that contains no scopes. - provides the subaccount identifier from the
ext_attr
claim.
- Audience Validation is skipped when
- [spring-xsuaa] provides the subaccount identifier from the
ext_attr
claim.
- [java-security]
- Audience Validation accepts tokens of grant type
user_token
that does not provideaud
claim. In that caseJwtAudienceValidator
derives the audiences from the scopes.
- Audience Validation accepts tokens of grant type
- Use
getSubaccountId()
only to fetch the subaccount id, e.g. for calling the metering API for user-based pricing. - In case you are interested in the customers tenant GUID make use of
getZoneId()
instead! - In upcoming releases - especially for new subaccounts - subaccount id will no longer match the tenant GUID which is provided via the xsuaa access token as
zid
claim or via the ias oidc token aszone_uuid
claim.
- [java-security]
XSUserInfoAdapter
provides now the subdomain that is required for token exchange viagetSubdomain()
method.- Avoid warning messages "IAS Service is not yet supported!". #273
- rename Token claim "sap_uid" to „user_uuid“.
- Token Key Cache can now be customized via
XsuaaTokenAuthenticator
. XSUserInfoAdapter
supportsrequestTokenForUser()
method.- set validators to package private, you can customize the JWT validators using the
JwtValidatorBuilder
. - Create validation results lazy. Avoid false warning validation results from
JwtAudienceValidator
(#290), e.g.
Jwt token with audience [<appId>, uaa] is not issued for these clientIds: [<appId>].
- [spring-xsuaa] Improve logs of Audience Validators.
- [spring-xsuaa-starter] Upgrade Spring versions:
- spring.boot.version: 2.2.6.RELEASE --> 2.3.0.RELEASE
- spring.core.version: 5.2.5.RELEASE --> 5.2.6.RELEASE
- spring.security.version: 5.3.1.RELEASE --> 5.3.2.RELEASE
- spring.security.oauth2: 2.4.0.RELEASE -> 2.4.1.RELEASE
- [spring-xsuaa-test]
- renamed file
privateKey.txt
tospring-xsuaa-privateKey.txt
andpublicKey.txt
tospring-xsuaa-publicKey.txt
to avoid name clashes in context of CAP, which results in a strangeIllegalArgumentException:failed to construct sequence from byte[]: DEF length 1213 object truncated by 2
. This can happen when you usejava-security-test
andspring-xsuaa-test
in parallel. - For new applications
spring-xsuaa-test
can be replaced in favor ofjava-security-test
for unit testing. For testing your app locally you can setup your local environment with theVCAP_SERVICES
in order to test with your XSUAA instance on Cloud Foundry.
- renamed file
- [token-client]
- more detailed debug logs and details to exception; decoded token gets logged.
- supports optional
scope
parameter to reduce scopes that are provided viaCientCredentialsTokenFlow
orUserTokenFlow
. - By default requested tokens are now cached. You can disable the cache globally or per request as described here.
- never log an encoded token! Instead you can log the
OAuth2TokenResponse
itself: thetoString()
method provides the content of the decoded token (clear text). Be aware that this contains sensitive user data.
- [token-client] By default requested tokens are now cached. You can disable the cache globally or per request as described here.
- [java-security]
XSUserInfoAdapter
provides now the subdomain that is required for token exchange viagetSubdomain()
method.- Avoid warning messages "IAS Service is not yet supported!".
- [spring-xsuaa-test]
- renamed file
privateKey.txt
tospring-xsuaa-privateKey.txt
andpublicKey.txt
tospring-xsuaa-publicKey.txt
to avoid name clashes in context of CAP, which results in a strangeIllegalArgumentException:failed to construct sequence from byte[]: DEF length 1213 object truncated by 2
. This can happen when you usejava-security-test
andspring-xsuaa-test
in parallel. - For new applications
spring-xsuaa-test
can be replaced in favor ofjava-security-test
for unit testing. For testing your app locally you can setup your local environment with theVCAP_SERVICES
in order to test with your XSUAA instance on Cloud Foundry.
- renamed file
- [spring-xsuaa-starter] Upgrade Spring versions:
- spring.boot.version: 2.2.6.RELEASE --> 2.3.0.RELEASE
- spring.core.version: 5.2.5.RELEASE --> 5.2.6.RELEASE
- spring.security.version: 5.3.1.RELEASE --> 5.3.2.RELEASE
- spring.security.oauth2: 2.4.0.RELEASE -> 2.4.1.RELEASE
- [java-security]
XSUserInfoAdapter
provides full compatible implementation ofcom.sap.xsa.security.container.XSUserInfo.java
interface. Support token exchanges usingXsuaaTokenFlows
api. - [spring-xsuaa] Improve support of multiple XSUAA Bindings as described here.
- [spring-xsuaa-starter] Upgrade Spring versions:
- spring.boot.version: 2.2.5.RELEASE --> 2.2.6.RELEASE
- spring.core.version: 5.2.4.RELEASE --> 5.2.5.RELEASE
- spring.security.version: 5.2.2.RELEASE --> 5.3.1.RELEASE
- [spring-xsuaa] SpringSecurityContext throws
AccessDeniedException
instead ofIllegalStateException
when authentication does not contain principal of type Token. - [java-security]
JwtAudienceValidator
Support Audience Validation of Xsuaa Broker clones (multiple xsuaa bindings): NGPBUG-111540. - [java-security-test] Basic support fo JUnit 5 (Jupiter).
- [java-security-test] Deprecation:
SecurityTestRule#getWireMockRule()
needs to be replaced bygetWireMockServer()
. - [java-security-test] One instance of
SecurityTestRule
should run only one WireMock server. With that@ClassRule SecurityTestRule
can be declared in a base class.
- [spring-xsuaa]
XsuaaJwtDecoder
supports verificationkey fromVCAP_SERVICES
as fallback public key. - [spring-xsuaa] when using
auto-configuration
and expose your ownRestTemplate
RestOperations
bean, have a look at this documentation. - [java-security-test]
JwtGenerator
supportswithLocalScopes()
. - [java-security]
SapIdToken
should return value of claim "sap_uid" (SAPGlobalUserID) as Principal name. - [java-security]
JwtAudienceValidator
Support Audience Validation of Xsuaa Broker clones: NGPBUG-111540. - [java-api] enhanced with config interfaces, which are relevant for SAP Java Buildpack.
- [api] changes
XSUserInfoException
fromException
toRuntimeException
. This reflects the json-lib change injava-container-security
(version3.12.0
).
- [java-api], [java-security], [token-client] works with logger api
slf4j-api
and does no longer provide the slf4j-implementation. Please have a look at the java-security/README.md#logging documentation. - [xsuaa-spring-boot-starter] update spring-boot (security) dependency versions #239.
- [java-security-test]
SecurityTestRule.setKeys
allows to customize private/public keys that are located in the resource path, e.g.src/main/resources
orsrc/test/resources
. - [java-security-test] configures the modulus of the public key provided by
WireMock
. With that the public key can be consumed by the Nimbus Jwt decoder. - [samples/spring-security-xsuaa-usage] demonstrates how to setup JUnit tests using
java-security-test
library.
- [java-api] As preparation for the SAP Java Buildpack the interfaces, as well as the
SecurityContext
is extracted to java-api. - [java-security]
AccessToken
s provided via theSpringSecurityContext
should also support thehasLocalScope
method.
- [java-security-test]
JwtGenerator.withClaimsFromFile
accepts claims from a file. - [java-security] Provides with
SpringSecurityContext
an alternative way of accessing jwt tokens for Spring applications in asynchronous threads. - [token-client] The
UserTokenFlow
has used the "user_token" grant type together with the "refresh_token" grant type in order to do the token exchange. After the consumption of UAA 4.27 we can adapt the grant type "urn:ietf:params:oauth:grant-type:jwt-bearer". This reduces the round trips to the XSUAA from 2 to 1. Further, it eliminates the need for the user to have scope "uaa.user". The feature flagxsuaa.userTokenFlow.useJwtBearer
has become obsolete.
- [java-security] Initial / released version of the new plain Java security libraries as documented here.
- [spring-xsuaa] Fix vulnerability issues and increased Spring versions.
- [spring-xsuaa] Bug fix in TokenBrokerResolver: Second configured authentication method was ignored.
- Issue: Spring tests fail with version
2.2.0
, when auto-configuration is disabled and noRestOperations
bean is specified. - [token-client] Supports basically JWT Bearer Token Grant as documented here.
- [token-client] Bug fix for state issue in HttpHeaderFactor (#200) that causes interference between different types of token flows.
- [spring-xsuaa] xsuaa bindings of plan
apiaccess
does not cause an error, as they get ignored for token validation.
- [spring-xsuaa]
PropertySourceFactory
supports custom property sources and default can optionally be disabled withspring.xsuaa.disable-default-property-source=true
- [spring-xsuaa] Supports Spring Core
5.2.0.RELEASE
and Spring Boot2.2.0.RELEASE
- [spring-xsuaa] Deprecates
TokenUrlUtils
in favor ofOAuth2ServiceEndpointsProvider
- Internally, we've cleaned up maven dependencies (converged versions) and
- removed transient dependency of
spring-security-oauth2
tojackson
. - introduced
org.owasp.dependency-check-maven
which performs CVSS checks.
- removed transient dependency of
- [token-client] Supports password token flows as documented here.
token-client
library supports Apache Http Client (without any Spring dependencies). Have also a look at the java-tokenclient-usage sample application.- Fix CVE-2018-1000613 by removing unnecessary dependencies (issue 144).
- Makes
XsuaaMockWebServer
more robust.
- Deleted package
com.sap.xs2.security.container
in order to avoid Class Loader issues, when an application makes use of SAP-libraries using the SAP-internal container lib like CAP.- As already mentioned use
SpringSecurityContext
class instead ofSecurityContext
class.
- As already mentioned use
- Removed deprecated methods:
XsuaaServiceConfiguration.getTokenUrl()
XsuaaToken.getClaimAccessor()
is not required anymore asXsuaa
itself implementsJwtClaimAccessor
.
- Deprecated
TokenBroker
interface and its implementationUaaTokenBroker
, as this is going to be replaced with theOAuth2TokenService
interface which is provided by the newtoken-client
library. If you wish to configure / pass yourRestTemplate
you can pass an instance ofOAuth2TokenService
:
new TokenBrokerResolver(
<<your configuration>>,
<<your cache>>,
new XsuaaOAuth2TokenService(<<your restTemplate>>),
<<your authenticationInformationExtractor>>);
TokenUlrUtils
class is now package protected and will be deleted with version.token-client
library supports basically Password-Grant Access Tokens.
-
We now provide a new slim
token-client
library with aXsuaaTokenFlows
class, which serves as a factory for the different flows (user, refresh and client-credentials). This deprecates the existingToken.requestToken(XSTokenRequest)
API.- The
token-client
library can be used by plain Java applications. - Auto-configuration is provided for Spring Boot applications only, when using XSUAA Spring Boot Starter.
- The
-
ANNOUNCEMENT: Please be aware that with version
2.0.0
we want to get rid of packagecom.sap.xs2.security.container
in order to avoid Class Loader issues, when an application makes use of SAP-libraries using the SAP-internal container lib.
- Provides spring starter for spring-xsuaa, which enables auto-configuration
- Supports reactive ServerHttpSecurity (Spring webflux). Have a look at the (webflux sample application)[samples/spring-webflux-security-xsuaa-usage/README.md]
- Some enhancements for XSUAA integration
- To make sure that the Spring SecurityContext is always initialized with a validated token use
SpringSecurityContext.init()
method as documented here - Use
SpringSecurityContext
instead ofSecurityContext
, which gets deprecated in this version.
- As of version
1.6.0
you need to make use of XSUAA Spring Boot Starter in order to leverage auto-configuration (see "Troubleshoot" section here)
- Supports
jku
URI which is provided as part of the JSON Web Signature (JWS). Thejku
of the Jwt token header references the public key URI of the Xsuaa OAuth Authorization Server, and needs to match to thexsuaa.uaadomain
. - Completely customizable auto-configurations so that apps can override the spring-xsuaa defaults:
- Uses apache slf4j Logger for better log analysis on Cloud Foundry. This is provided with org.springframework.boot:spring-boot-starter-logging.
- Improves and enhances sample application.
- Renames class
TokenImpl
toXsuaaToken
. Furthermore for convenienceXsuaaToken
subclassesorg.springframework.security.oauth2.jwt.Jwt
. - Subclassing of
TokenAuthenticationConverter
is no longer allowed, insteadTokenAuthenticationConverter
can be configured with your ownAuthoritiesExtractor
implementation (an example can be found here). - Please note that the port of the mock web server that is provided with the xsuaa mock library had to be defined statically. It runs now always on port 33195.
- Find more complex examples here: https://github.com/SAP/cloud-application-security-sample
- API method to query token validity
- Bugfix in basic authentication support: allow usage of JWT token or basic authentication with one configuration
- Allows overwrite / enhancement of XSUAA jwt token validators
- Allow applications to initialize of Spring SecurityContext for non HTTP requests. As documented here
- Broker plan validation failed due to incorrect audience validation
- JwtGenerator offers enhancement options: custom claims and audience
- Test framework support for multi tenancy
- Eases enhancement of TokenAuthenticationConverter (issue 23)
- Makes XsuaaAudienceValidator more robust (issue 21)
- XSTokenRequest accepts custom RestTemplate (issue 25)
- Provides spring-xsuaa-test library with JWTGenerator (issue 29)
- Provides spring-xsuaa-mock library with XSUAA authentication mock web server for offline token key validation (issue 30)
- Spring-Security 5 integration libraries. Added AudienceValidator
- Spring-Security 5 Support for basic authentication
- Initial version including spring-security 5 integration libraries
- Initial version of the api for SAP Java Buildpack