Repository: SAP/cloud-security-xsuaa-integration (java)

Issue:
Add token_type in OAuth2TokenResponse
Hi Colleagues,

We are trying to use the XSUAA Token Client and Token Flow API for token retrieval.

However, there is one little problem.

If we look at OAuth2TokenResponse we can see that it contains the access token and its expiration time, but it doesn't contain the token type.

Could you please add it to the OAuth2TokenResponse so that there won't be need to use a hard-coded "Bearer " string in our code?

Best regards,
Tsvetomir Lyubenov

Pull request description:
Expose token_type in OAuth2TokenResponse
Fixes #606 

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 39123144..7e35d55d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,18 @@
 # Change Log
 All notable changes to this project will be documented in this file.
 
+## 2.10.4
+Client Libraries support Kubernetes/Kyma environment
+- [samples/java-security-usage] enabled for Kyma/Kubernetes environment
+- [samples/spring-security-basic-auth] enabled for Kyma/Kubernetes environment
+- [samples/spring-security-xsuaa-usage] enabled for Kyma/Kubernetes environment
+- [samples/spring-security-hybrid-usage] enabled for Kyma/Kubernetes environment
+
+#### Dependency upgrades
+- wiremock 2.29.1 --> 2.30.1
+- io.projectreactor:reactor-core 3.4.8 --> 3.4.9  
+- io.projectreactor:reactor-test 3.4.8 --> 3.4.9
+
 ## 2.10.3
 #### Dependency upgrades
 - org.springframework.boot:spring-boot 2.5.0 --> 2.5.2
diff --git a/api/README.md b/api/README.md
index db1d1369..18996768 100644
--- a/api/README.md
+++ b/api/README.md
@@ -5,6 +5,6 @@
 <dependency>
     <groupId>com.sap.cloud.security.xsuaa</groupId>
     <artifactId>api</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
 </dependency>
 ```
diff --git a/api/pom.xml b/api/pom.xml
index 61a55558..3a9652b6 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -11,7 +11,7 @@
 	<parent>
 		<groupId>com.sap.cloud.security.xsuaa</groupId>
 		<artifactId>parent</artifactId>
-		<version>2.10.3</version>
+		<version>2.10.4</version>
 	</parent>
 
 	<packaging>jar</packaging>
diff --git a/java-api/README.md b/java-api/README.md
index 1776332f..01b71c48 100644
--- a/java-api/README.md
+++ b/java-api/README.md
@@ -5,6 +5,6 @@
 <dependency>
     <groupId>com.sap.cloud.security</groupId>
     <artifactId>java-api</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
 </dependency>
 ```
diff --git a/java-api/pom.xml b/java-api/pom.xml
index e002c702..9f998761 100644
--- a/java-api/pom.xml
+++ b/java-api/pom.xml
@@ -9,7 +9,7 @@
 	<parent>
 		<groupId>com.sap.cloud.security.xsuaa</groupId>
 		<artifactId>parent</artifactId>
-		<version>2.10.3</version>
+		<version>2.10.4</version>
 	</parent>
 
 	<groupId>com.sap.cloud.security</groupId>
diff --git a/java-api/src/main/java/com/sap/cloud/security/json/JsonParsingException.java b/java-api/src/main/java/com/sap/cloud/security/json/JsonParsingException.java
index d145f8e4..89ca6568 100644
--- a/java-api/src/main/java/com/sap/cloud/security/json/JsonParsingException.java
+++ b/java-api/src/main/java/com/sap/cloud/security/json/JsonParsingException.java
@@ -13,4 +13,8 @@ public class JsonParsingException extends RuntimeException {
 	public JsonParsingException(String message) {
 		super(message);
 	}
+
+	public JsonParsingException(String message, Throwable cause) {
+		super(message, cause);
+	}
 }
diff --git a/java-security-it/pom.xml b/java-security-it/pom.xml
index 06fe119a..e595ade0 100644
--- a/java-security-it/pom.xml
+++ b/java-security-it/pom.xml
@@ -9,7 +9,7 @@
     <parent>
         <artifactId>parent</artifactId>
         <groupId>com.sap.cloud.security.xsuaa</groupId>
-        <version>2.10.3</version>
+        <version>2.10.4</version>
     </parent>
 
     <artifactId>java-security-it</artifactId>
diff --git a/java-security/Migration_SpringSecurityProjects.md b/java-security/Migration_SpringSecurityProjects.md
index 55d0c978..b76c77b1 100644
--- a/java-security/Migration_SpringSecurityProjects.md
+++ b/java-security/Migration_SpringSecurityProjects.md
@@ -37,19 +37,19 @@ First make sure you have the following dependencies defined in your pom.xml:
 <dependency>
   <groupId>com.sap.cloud.security.xsuaa</groupId>
   <artifactId>api</artifactId>
-  <version>2.10.3</version>
+  <version>2.10.4</version>
 </dependency>
 <dependency>
   <groupId>com.sap.cloud.security</groupId>
   <artifactId>java-security</artifactId>
-  <version>2.10.3</version>
+  <version>2.10.4</version>
 </dependency>
 
 <!-- new java-security dependencies for unit tests -->
 <dependency>
   <groupId>com.sap.cloud.security</groupId>
   <artifactId>java-security-test</artifactId>
-  <version>2.10.3</version>
+  <version>2.10.4</version>
   <scope>test</scope>
 </dependency>
 ```
diff --git a/java-security/README.md b/java-security/README.md
index b8356f9f..c570b2bc 100644
--- a/java-security/README.md
+++ b/java-security/README.md
@@ -47,7 +47,7 @@ In case of XSUAA does the JWT provide a valid `jku` token header parameter that
 <dependency>
     <groupId>com.sap.cloud.security</groupId>
     <artifactId>java-security</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
 </dependency>
 <dependency>
     <groupId>org.apache.httpcomponents</groupId>
diff --git a/java-security/pom.xml b/java-security/pom.xml
index af44b7e6..3ee252c0 100644
--- a/java-security/pom.xml
+++ b/java-security/pom.xml
@@ -9,7 +9,7 @@
 	<parent>
 		<groupId>com.sap.cloud.security.xsuaa</groupId>
 		<artifactId>parent</artifactId>
-		<version>2.10.3</version>
+		<version>2.10.4</version>
 	</parent>
 
 	<groupId>com.sap.cloud.security</groupId>
diff --git a/java-security/src/main/java/com/sap/cloud/security/servlet/HybridTokenFactory.java b/java-security/src/main/java/com/sap/cloud/security/servlet/HybridTokenFactory.java
index d25a45be..960d54e4 100644
--- a/java-security/src/main/java/com/sap/cloud/security/servlet/HybridTokenFactory.java
+++ b/java-security/src/main/java/com/sap/cloud/security/servlet/HybridTokenFactory.java
@@ -8,6 +8,7 @@ package com.sap.cloud.security.servlet;
 import com.sap.cloud.security.config.Environments;
 import com.sap.cloud.security.config.OAuth2ServiceConfiguration;
 import com.sap.cloud.security.config.cf.CFConstants;
+import com.sap.cloud.security.json.JsonParsingException;
 import com.sap.cloud.security.token.*;
 import com.sap.cloud.security.xsuaa.Assertions;
 import com.sap.cloud.security.xsuaa.jwt.Base64JwtDecoder;
@@ -43,14 +44,17 @@ public class HybridTokenFactory implements TokenFactory {
 	 * @return the new token instance
 	 */
 	public Token create(String jwtToken) {
+		try {
+			Objects.requireNonNull(jwtToken, "Requires encoded jwtToken to create a Token instance.");
+			DecodedJwt decodedJwt = Base64JwtDecoder.getInstance().decode(removeBearer(jwtToken));
 
-		Objects.requireNonNull(jwtToken, "Requires encoded jwtToken to create a Token instance.");
-		DecodedJwt decodedJwt = Base64JwtDecoder.getInstance().decode(removeBearer(jwtToken));
-
-		if (isXsuaaToken(decodedJwt)) {
-			return new XsuaaToken(decodedJwt).withScopeConverter(getOrCreateScopeConverter());
+			if (isXsuaaToken(decodedJwt)) {
+				return new XsuaaToken(decodedJwt).withScopeConverter(getOrCreateScopeConverter());
+			}
+			return new SapIdToken(decodedJwt);
+		} catch (JsonParsingException e) {
+			throw new JsonParsingException(String.format("Issue with Jwt parsing. Authorization header: %s - %s", jwtToken.substring(0, 20), e.getMessage()), e);
 		}
-		return new SapIdToken(decodedJwt);
 	}
 
 	/**
@@ -76,7 +80,7 @@ public class HybridTokenFactory implements TokenFactory {
 		if (xsAppId == null) {
 			OAuth2ServiceConfiguration serviceConfiguration = Environments.getCurrent().getXsuaaConfiguration();
 			if (serviceConfiguration == null) {
-				LOGGER.error("There is no xsuaa service configuration: no local scope check possible.");
+				LOGGER.warn("There is no xsuaa service configuration: no local scope check possible.");
 			} else {
 				xsAppId = serviceConfiguration.getProperty(CFConstants.XSUAA.APP_ID);
 			}
diff --git a/pom.xml b/pom.xml
index 3e27b7c6..cd1230aa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
 
 	<groupId>com.sap.cloud.security.xsuaa</groupId>
 	<artifactId>parent</artifactId>
-	<version>2.10.3</version>
+	<version>2.10.4</version>
 	<packaging>pom</packaging>
 
 	<name>parent</name>
diff --git a/samples/java-security-usage-ias/pom.xml b/samples/java-security-usage-ias/pom.xml
index e88c2ca4..4ef6258a 100755
--- a/samples/java-security-usage-ias/pom.xml
+++ b/samples/java-security-usage-ias/pom.xml
@@ -6,7 +6,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sap.cloud.security.xssec.samples</groupId>
     <artifactId>java-security-usage-ias</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
     <packaging>war</packaging>
 
     <!--profiles>
@@ -27,7 +27,7 @@
     <properties>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
-        <sap.cloud.security.version>2.10.3</sap.cloud.security.version>
+        <sap.cloud.security.version>2.10.4</sap.cloud.security.version>
         <slf4j.api.version>1.7.30</slf4j.api.version>
         <apache.httpclient.version>4.5.13</apache.httpclient.version>
         <javax.servlet.api.version>4.0.1</javax.servlet.api.version>
diff --git a/samples/java-security-usage/pom.xml b/samples/java-security-usage/pom.xml
index f46e55c3..f4b7b09c 100755
--- a/samples/java-security-usage/pom.xml
+++ b/samples/java-security-usage/pom.xml
@@ -6,7 +6,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sap.cloud.security.xssec.samples</groupId>
     <artifactId>java-security-usage</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
     <packaging>war</packaging>
 
     <!--profiles>
@@ -27,7 +27,7 @@
     <properties>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
-        <sap.cloud.security.version>2.10.3</sap.cloud.security.version>
+        <sap.cloud.security.version>2.10.4</sap.cloud.security.version>
         <slf4j.api.version>1.7.30</slf4j.api.version>
         <apache.httpclient.version>4.5.13</apache.httpclient.version>
         <javax.servlet.api.version>4.0.1</javax.servlet.api.version>
diff --git a/samples/java-tokenclient-usage/pom.xml b/samples/java-tokenclient-usage/pom.xml
index 9adced79..39feefbd 100755
--- a/samples/java-tokenclient-usage/pom.xml
+++ b/samples/java-tokenclient-usage/pom.xml
@@ -6,13 +6,13 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sap.cloud.security.xssec.samples</groupId>
     <artifactId>java-tokenclient-usage</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
     <packaging>war</packaging>
 
     <properties>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
-        <sap.cloud.security.version>2.10.3</sap.cloud.security.version>
+        <sap.cloud.security.version>2.10.4</sap.cloud.security.version>
         <apache.httpclient.version>4.5.13</apache.httpclient.version>
         <javax.servlet.api.version>4.0.1</javax.servlet.api.version>
         <slf4j.api.version>1.7.30</slf4j.api.version>
diff --git a/samples/sap-java-buildpack-api-usage/pom.xml b/samples/sap-java-buildpack-api-usage/pom.xml
index b2d122c6..ff1104e9 100755
--- a/samples/sap-java-buildpack-api-usage/pom.xml
+++ b/samples/sap-java-buildpack-api-usage/pom.xml
@@ -6,7 +6,7 @@
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>com.sap.cloud.security.xssec.samples</groupId>
 	<artifactId>sap-java-buildpack-api-usage</artifactId>
-	<version>2.10.3</version>
+	<version>2.10.4</version>
 	<packaging>war</packaging>
 
 	<properties>
diff --git a/samples/spring-security-basic-auth/pom.xml b/samples/spring-security-basic-auth/pom.xml
index 0cc34936..2fbbe8cc 100644
--- a/samples/spring-security-basic-auth/pom.xml
+++ b/samples/spring-security-basic-auth/pom.xml
@@ -13,14 +13,14 @@
 	</parent>
 
 	<artifactId>spring-security-basic-auth</artifactId>
-	<version>2.10.3</version>
+	<version>2.10.4</version>
 	<name>spring-security-basic-auth</name>
 
 	<properties>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 		<java.version>1.8</java.version>
-		<sap.cloud.security.version>2.10.3</sap.cloud.security.version>
+		<sap.cloud.security.version>2.10.4</sap.cloud.security.version>
 		<apache.httpclient.version>4.5.13</apache.httpclient.version>
 	</properties>
 
diff --git a/samples/spring-security-hybrid-usage/pom.xml b/samples/spring-security-hybrid-usage/pom.xml
index 77695a8b..c5cd12c5 100644
--- a/samples/spring-security-hybrid-usage/pom.xml
+++ b/samples/spring-security-hybrid-usage/pom.xml
@@ -16,7 +16,7 @@
 
 	<groupId>com.sap.cloud.security.samples</groupId>
 	<artifactId>spring-security-hybrid-usage</artifactId>
-	<version>2.10.3</version>
+	<version>2.10.4</version>
 
 	<properties>
 		<!-- 
@@ -28,7 +28,7 @@
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 		<java.version>1.8</java.version>
-		<sap.cloud.security.version>2.10.3</sap.cloud.security.version>
+		<sap.cloud.security.version>2.10.4</sap.cloud.security.version>
 		<apache.httpclient.version>4.5.13</apache.httpclient.version>
 	</properties>
 
diff --git a/samples/spring-security-xsuaa-usage/pom.xml b/samples/spring-security-xsuaa-usage/pom.xml
index 68974d51..7ed159f3 100644
--- a/samples/spring-security-xsuaa-usage/pom.xml
+++ b/samples/spring-security-xsuaa-usage/pom.xml
@@ -16,7 +16,7 @@
 
 	<groupId>com.sap.cloud.security.samples</groupId>
 	<artifactId>spring-security-xsuaa-usage</artifactId>
-	<version>2.10.3</version>
+	<version>2.10.4</version>
 	<name>spring-security-xsuaa-usage</name>
 
 	<properties>
@@ -29,7 +29,7 @@
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 		<java.version>1.8</java.version>
-		<sap.cloud.security.version>2.10.3</sap.cloud.security.version>
+		<sap.cloud.security.version>2.10.4</sap.cloud.security.version>
 		<apache.httpclient.version>4.5.13</apache.httpclient.version>
 	</properties>
 
diff --git a/samples/spring-webflux-security-xsuaa-usage/pom.xml b/samples/spring-webflux-security-xsuaa-usage/pom.xml
index 9cf93bd5..34d5b532 100644
--- a/samples/spring-webflux-security-xsuaa-usage/pom.xml
+++ b/samples/spring-webflux-security-xsuaa-usage/pom.xml
@@ -14,12 +14,12 @@
 
     <groupId>com.sap.cloud.security.samples</groupId>
     <artifactId>spring-webflux-security-xsuaa-usage</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
     <name>spring-webflux-security-xsuaa-usage</name>
 
     <properties>
         <java.version>1.8</java.version>
-        <sap.cloud.security.version>2.10.3</sap.cloud.security.version>
+        <sap.cloud.security.version>2.10.4</sap.cloud.security.version>
     </properties>
 
     <dependencies>
diff --git a/spring-security-starter/pom.xml b/spring-security-starter/pom.xml
index 9430173e..eca8598b 100644
--- a/spring-security-starter/pom.xml
+++ b/spring-security-starter/pom.xml
@@ -16,7 +16,7 @@
 	<parent>
 		<groupId>com.sap.cloud.security.xsuaa</groupId>
 		<artifactId>parent</artifactId>
-		<version>2.10.3</version>
+		<version>2.10.4</version>
 	</parent>
 
 	<groupId>com.sap.cloud.security</groupId>
diff --git a/spring-security/README.md b/spring-security/README.md
index c5fc39d4..f1da1370 100644
--- a/spring-security/README.md
+++ b/spring-security/README.md
@@ -34,7 +34,7 @@ These (spring) dependencies needs to be provided:
 <dependency>
     <groupId>com.sap.cloud.security</groupId>
     <artifactId>resourceserver-security-spring-boot-starter</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
 </dependency>
 <dependency>
     <groupId>org.apache.httpcomponents</groupId>
diff --git a/spring-security/pom.xml b/spring-security/pom.xml
index 4856d4b2..7da61c49 100644
--- a/spring-security/pom.xml
+++ b/spring-security/pom.xml
@@ -9,13 +9,13 @@
 	<parent>
 		<groupId>com.sap.cloud.security.xsuaa</groupId>
 		<artifactId>parent</artifactId>
-		<version>2.10.3</version>
+		<version>2.10.4</version>
 	</parent>
 
 	<groupId>com.sap.cloud.security</groupId>
 	<artifactId>spring-security</artifactId>
 	<packaging>jar</packaging>
-	<version>2.10.3</version>
+	<version>2.10.4</version>
 
 	<dependencies>
 		<dependency>
diff --git a/spring-xsuaa-it/pom.xml b/spring-xsuaa-it/pom.xml
index b03438fa..03501870 100644
--- a/spring-xsuaa-it/pom.xml
+++ b/spring-xsuaa-it/pom.xml
@@ -8,7 +8,7 @@
 	<parent>
 		<groupId>com.sap.cloud.security.xsuaa</groupId>
 		<artifactId>parent</artifactId>
-		<version>2.10.3</version>
+		<version>2.10.4</version>
 	</parent>
 
 	<artifactId>spring-xsuaa-it</artifactId>
diff --git a/spring-xsuaa-mock/README.md b/spring-xsuaa-mock/README.md
index 5b79de9a..acbdf52c 100644
--- a/spring-xsuaa-mock/README.md
+++ b/spring-xsuaa-mock/README.md
@@ -21,7 +21,7 @@ The default implementation offers already valid *token_keys* for JWT tokens, tha
 <dependency>
     <groupId>com.sap.cloud.security.xsuaa</groupId>
     <artifactId>spring-xsuaa-mock</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
 </dependency>
 <dependency> <!-- new with version 1.5.0 - provided with org.springframework.boot:spring-boot-starter:jar -->
     <groupId>org.springframework.boot</groupId>
diff --git a/spring-xsuaa-mock/pom.xml b/spring-xsuaa-mock/pom.xml
index 373f6713..3678f1be 100644
--- a/spring-xsuaa-mock/pom.xml
+++ b/spring-xsuaa-mock/pom.xml
@@ -9,7 +9,7 @@
 	<parent>
 		<groupId>com.sap.cloud.security.xsuaa</groupId>
 		<artifactId>parent</artifactId>
-		<version>2.10.3</version>
+		<version>2.10.4</version>
 	</parent>
 
 	<artifactId>spring-xsuaa-mock</artifactId>
diff --git a/spring-xsuaa-starter/pom.xml b/spring-xsuaa-starter/pom.xml
index 6ac6363b..237f94fe 100644
--- a/spring-xsuaa-starter/pom.xml
+++ b/spring-xsuaa-starter/pom.xml
@@ -16,7 +16,7 @@
 	<parent>
 		<groupId>com.sap.cloud.security.xsuaa</groupId>
 		<artifactId>parent</artifactId>
-		<version>2.10.3</version>
+		<version>2.10.4</version>
 	</parent>
 
 	<artifactId>xsuaa-spring-boot-starter</artifactId>
diff --git a/spring-xsuaa/README.md b/spring-xsuaa/README.md
index aaf92ba1..c425c850 100644
--- a/spring-xsuaa/README.md
+++ b/spring-xsuaa/README.md
@@ -25,7 +25,7 @@ These (spring) dependencies needs to be provided:
 <dependency>
     <groupId>com.sap.cloud.security.xsuaa</groupId>
     <artifactId>spring-xsuaa</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
 </dependency>
 <dependency> <!-- new with version 1.5.0 -->
     <groupId>org.apache.logging.log4j</groupId>
@@ -39,7 +39,7 @@ These (spring) dependencies needs to be provided:
 <dependency>
     <groupId>com.sap.cloud.security.xsuaa</groupId>
     <artifactId>xsuaa-spring-boot-starter</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
 </dependency>
 ```
 
diff --git a/spring-xsuaa/pom.xml b/spring-xsuaa/pom.xml
index 64c74cfc..218f3a31 100644
--- a/spring-xsuaa/pom.xml
+++ b/spring-xsuaa/pom.xml
@@ -9,7 +9,7 @@
 	<parent>
 		<groupId>com.sap.cloud.security.xsuaa</groupId>
 		<artifactId>parent</artifactId>
-		<version>2.10.3</version>
+		<version>2.10.4</version>
 	</parent>
 
 	<artifactId>spring-xsuaa</artifactId>
diff --git a/spring-xsuaa/src/main/java/com/sap/cloud/security/xsuaa/XsuaaServiceConfigurationDefault.java b/spring-xsuaa/src/main/java/com/sap/cloud/security/xsuaa/XsuaaServiceConfigurationDefault.java
index 76c596a8..afdc07f9 100644
--- a/spring-xsuaa/src/main/java/com/sap/cloud/security/xsuaa/XsuaaServiceConfigurationDefault.java
+++ b/spring-xsuaa/src/main/java/com/sap/cloud/security/xsuaa/XsuaaServiceConfigurationDefault.java
@@ -12,7 +12,9 @@ import com.sap.cloud.security.config.CredentialType;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
 
+import java.io.IOException;
 import java.net.URI;
+import java.util.Properties;
 
 @Configuration
 public class XsuaaServiceConfigurationDefault implements XsuaaServiceConfiguration {
@@ -29,9 +31,6 @@ public class XsuaaServiceConfigurationDefault implements XsuaaServiceConfigurati
 	@Value("${xsuaa.uaadomain:#{null}}")
 	private String uaadomain;
 
-	@Value("${xsuaa.identityzoneid:}")
-	private String identityZoneId;
-
 	@Value("${xsuaa.xsappname:}")
 	private String appid;
 
@@ -50,6 +49,8 @@ public class XsuaaServiceConfigurationDefault implements XsuaaServiceConfigurati
 	@Value("${xsuaa.certurl:#{null}}")
 	private String certUrl;
 
+	private Properties vcapServiceProperties;
+
 	/*
 	 * (non-Javadoc)
 	 *
@@ -102,4 +103,25 @@ public class XsuaaServiceConfigurationDefault implements XsuaaServiceConfigurati
 	public URI getCertUrl() {
 		return URI.create(certUrl);
 	}
+
+	private Properties getVcapServiceProperties() {
+		if(vcapServiceProperties == null) {
+			try {
+				vcapServiceProperties = new XsuaaServicesParser().parseCredentials();
+			} catch (IOException e) {
+				vcapServiceProperties = new Properties();
+			}
+		}
+		return vcapServiceProperties;
+	}
+
+	@Override
+	public String getProperty(String name) {
+		return getVcapServiceProperties().getProperty(name);
+	}
+
+	@Override
+	public boolean hasProperty(String name) {
+		return getVcapServiceProperties().containsKey(name);
+	}
 }
diff --git a/spring-xsuaa/src/main/java/com/sap/cloud/security/xsuaa/XsuaaServicePropertySourceFactory.java b/spring-xsuaa/src/main/java/com/sap/cloud/security/xsuaa/XsuaaServicePropertySourceFactory.java
index 005ccf52..8ad49577 100644
--- a/spring-xsuaa/src/main/java/com/sap/cloud/security/xsuaa/XsuaaServicePropertySourceFactory.java
+++ b/spring-xsuaa/src/main/java/com/sap/cloud/security/xsuaa/XsuaaServicePropertySourceFactory.java
@@ -46,7 +46,7 @@ public class XsuaaServicePropertySourceFactory implements PropertySourceFactory
 	public static final String UAA_DOMAIN = "xsuaa.uaadomain";
 
 	private static final List<String> XSUAA_ATTRIBUTES = Arrays
-			.asList("clientid", "clientsecret", "identityzoneid",
+			.asList("clientid", "clientsecret",
 					"sburl", "tenantid", "tenantmode", "uaadomain", "url", "verificationkey", "xsappname",
 					"certificate",
 					"key", "credential-type", "certurl");
diff --git a/token-client/README.md b/token-client/README.md
index 774e8a89..f915cbdf 100644
--- a/token-client/README.md
+++ b/token-client/README.md
@@ -23,7 +23,7 @@ The Resource owner password credentials (i.e., username and password) can be use
 <dependency>
     <groupId>com.sap.cloud.security.xsuaa</groupId>
     <artifactId>token-client</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
 </dependency>
 <dependency>
   <groupId>org.apache.httpcomponents</groupId>
@@ -83,7 +83,7 @@ By default, the `DefaultOAuth2TokenService` caches tokens internally. The Cache
 <dependency>
     <groupId>com.sap.cloud.security.xsuaa</groupId>
     <artifactId>token-client</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
 </dependency>
 <dependency>
     <groupId>org.springframework</groupId>
@@ -136,7 +136,7 @@ In context of a Spring Boot application you may like to leverage auto-configurat
 <dependency>
     <groupId>com.sap.cloud.security.xsuaa</groupId>
     <artifactId>xsuaa-spring-boot-starter</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
 </dependency>
 <dependency> <!-- required when using Spring Web `RestTemplate` with X.509 authentication method-->
   <groupId>org.apache.httpcomponents</groupId>
diff --git a/token-client/pom.xml b/token-client/pom.xml
index 227b070a..78a7d8d9 100644
--- a/token-client/pom.xml
+++ b/token-client/pom.xml
@@ -9,7 +9,7 @@
 	<parent>
 		<groupId>com.sap.cloud.security.xsuaa</groupId>
 		<artifactId>parent</artifactId>
-		<version>2.10.3</version>
+		<version>2.10.4</version>
 	</parent>
 
 	<artifactId>token-client</artifactId>
diff --git a/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/DefaultOAuth2TokenService.java b/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/DefaultOAuth2TokenService.java
index b891813e..c567d2b0 100644
--- a/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/DefaultOAuth2TokenService.java
+++ b/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/DefaultOAuth2TokenService.java
@@ -113,8 +113,9 @@ public class DefaultOAuth2TokenService extends AbstractOAuth2TokenService {
 		String accessToken = getParameter(accessTokenMap, ACCESS_TOKEN);
 		String refreshToken = getParameter(accessTokenMap, REFRESH_TOKEN);
 		String expiresIn = getParameter(accessTokenMap, EXPIRES_IN);
+		String tokenType = getParameter(accessTokenMap, TOKEN_TYPE);
 		return new OAuth2TokenResponse(accessToken, convertExpiresInToLong(expiresIn),
-				refreshToken);
+				refreshToken, tokenType);
 	}
 
 	private Long convertExpiresInToLong(String expiresIn) throws OAuth2ServiceException {
diff --git a/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/OAuth2TokenResponse.java b/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/OAuth2TokenResponse.java
index f163cc30..d7675a48 100644
--- a/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/OAuth2TokenResponse.java
+++ b/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/OAuth2TokenResponse.java
@@ -14,14 +14,22 @@ import java.util.Date;
 import java.util.concurrent.TimeUnit;
 
 public class OAuth2TokenResponse {
-	private String refreshToken;
-	private String accessToken;
-	private long expiredTimeMillis;
+	static final String TOKEN_TYPE_DEFAULT = "bearer";
+	private final String refreshToken;
+	private final String accessToken;
+	private final String tokenType;
+	private final long expiredTimeMillis;
 
 	public OAuth2TokenResponse(@Nullable String accessToken, long expiredInSeconds, @Nullable String refreshToken) {
+		this(accessToken, expiredInSeconds, refreshToken, TOKEN_TYPE_DEFAULT);
+	}
+
+	public OAuth2TokenResponse(@Nullable String accessToken, long expiredInSeconds, @Nullable String refreshToken,
+			String tokenType) {
 		this.accessToken = accessToken;
 		this.expiredTimeMillis = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(expiredInSeconds);
 		this.refreshToken = refreshToken;
+		this.tokenType = tokenType;
 	}
 
 	/**
@@ -82,9 +90,13 @@ public class OAuth2TokenResponse {
 		return refreshToken;
 	}
 
+	public String getTokenType() {
+		return tokenType;
+	}
+
 	@Override
 	public String toString() {
-		DecodedJwt decodedJwt = null;
+		DecodedJwt decodedJwt;
 		try {
 			decodedJwt = getDecodedAccessToken();
 		} catch (IllegalArgumentException e) {
diff --git a/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/OAuth2TokenServiceConstants.java b/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/OAuth2TokenServiceConstants.java
index 02b21ad5..0663980d 100644
--- a/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/OAuth2TokenServiceConstants.java
+++ b/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/OAuth2TokenServiceConstants.java
@@ -14,6 +14,7 @@ public class OAuth2TokenServiceConstants {
 	public static final String ACCESS_TOKEN = "access_token";
 	public static final String EXPIRES_IN = "expires_in";
 	public static final String REFRESH_TOKEN = "refresh_token";
+	public static final String TOKEN_TYPE = "token_type";
 	public static final String CLIENT_ID = "client_id";
 	public static final String CLIENT_SECRET = "client_secret";
 	public static final String USERNAME = "username";
diff --git a/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenService.java b/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenService.java
index cf3aad59..d8db9f35 100644
--- a/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenService.java
+++ b/token-client/src/main/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenService.java
@@ -106,7 +106,8 @@ public class XsuaaOAuth2TokenService extends AbstractOAuth2TokenService {
 		String accessToken = accessTokenMap.get(ACCESS_TOKEN);
 		long expiresIn = Long.parseLong(String.valueOf(accessTokenMap.get(EXPIRES_IN)));
 		String refreshToken = accessTokenMap.get(REFRESH_TOKEN);
-		return new OAuth2TokenResponse(accessToken, expiresIn, refreshToken);
+		String tokenType = accessTokenMap.get(TOKEN_TYPE);
+		return new OAuth2TokenResponse(accessToken, expiresIn, refreshToken, tokenType);
 	}
 
 	/**
diff --git a/token-client/src/main/java/com/sap/cloud/security/xsuaa/jwt/Base64JwtDecoder.java b/token-client/src/main/java/com/sap/cloud/security/xsuaa/jwt/Base64JwtDecoder.java
index 83cb1b02..8911e58b 100644
--- a/token-client/src/main/java/com/sap/cloud/security/xsuaa/jwt/Base64JwtDecoder.java
+++ b/token-client/src/main/java/com/sap/cloud/security/xsuaa/jwt/Base64JwtDecoder.java
@@ -59,10 +59,10 @@ public final class Base64JwtDecoder {
 
 	static class DecodedJwtImpl implements DecodedJwt {
 
-		private String header;
-		private String payload;
-		private String signature;
-		private String encodedJwt;
+		private final String header;
+		private final String payload;
+		private final String signature;
+		private final String encodedJwt;
 		private static final String TAB = "\t";
 		private static final Logger LOGGER = LoggerFactory.getLogger(DecodedJwtImpl.class);
 
@@ -71,6 +71,9 @@ public final class Base64JwtDecoder {
 			this.payload = payload;
 			this.signature = signature;
 			this.encodedJwt = encodedJwt;
+			if (LOGGER.isDebugEnabled()) {
+				LOGGER.debug(toString());
+			}
 		}
 
 		@Override
@@ -95,13 +98,10 @@ public final class Base64JwtDecoder {
 
 		@Override
 		public String toString() {
-			StringBuilder stringBuilder = new StringBuilder();
-			stringBuilder.append("Jwt header" + lineSeparator());
-			stringBuilder.append(TAB + getHeader() + lineSeparator());
-			stringBuilder.append("Jwt payload" + lineSeparator());
-			stringBuilder.append(TAB + getPayload() + lineSeparator());
-
-			return stringBuilder.toString();
+			return  "Jwt header" + lineSeparator() +
+					TAB + getHeader() + lineSeparator() +
+					"Jwt payload" + lineSeparator() +
+					TAB + getPayload() + lineSeparator();
 		}
 	}
 }
diff --git a/token-client/src/main/java/com/sap/cloud/security/xsuaa/tokenflows/XsuaaTokenFlows.java b/token-client/src/main/java/com/sap/cloud/security/xsuaa/tokenflows/XsuaaTokenFlows.java
index 90eabea8..8fb9f88d 100644
--- a/token-client/src/main/java/com/sap/cloud/security/xsuaa/tokenflows/XsuaaTokenFlows.java
+++ b/token-client/src/main/java/com/sap/cloud/security/xsuaa/tokenflows/XsuaaTokenFlows.java
@@ -40,7 +40,7 @@ public class XsuaaTokenFlows implements Serializable {
 	 *            the OAuth2.0 client identity
 	 *
 	 *            <pre>
-	 * {@code
+	 *            {@code
 	 * String clientId     = "<<get your client id from your service binding>>";
 	 * String clientSecret = "<<get your client secret from your service binding>>";
 	 * String xsuaaBaseUrl = "<<get your xsuaa base url from service binding>>";


Test patch:
diff --git a/java-security-test/README.md b/java-security-test/README.md
index 4394ea62..1a8ade92 100644
--- a/java-security-test/README.md
+++ b/java-security-test/README.md
@@ -22,7 +22,7 @@ It includes for example a `JwtGenerator` that generates JSON Web Tokens (JWT) th
 <dependency>
     <groupId>com.sap.cloud.security</groupId>
     <artifactId>java-security-test</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
     <scope>test</scope>
 </dependency>
 ```
diff --git a/java-security-test/pom.xml b/java-security-test/pom.xml
index c0094f0c..fdcbf795 100644
--- a/java-security-test/pom.xml
+++ b/java-security-test/pom.xml
@@ -9,7 +9,7 @@
 	<parent>
 		<groupId>com.sap.cloud.security.xsuaa</groupId>
 		<artifactId>parent</artifactId>
-		<version>2.10.3</version>
+		<version>2.10.4</version>
 	</parent>
 
 	<groupId>com.sap.cloud.security</groupId>
diff --git a/spring-xsuaa-test/README.md b/spring-xsuaa-test/README.md
index 7fe27e29..2664df06 100644
--- a/spring-xsuaa-test/README.md
+++ b/spring-xsuaa-test/README.md
@@ -31,7 +31,7 @@ This includes for example a `JwtGenerator` that generates JSON Web Tokens (JWT)
 <dependency>
     <groupId>com.sap.cloud.security.xsuaa</groupId>
     <artifactId>spring-xsuaa-test</artifactId>
-    <version>2.10.3</version>
+    <version>2.10.4</version>
     <scope>test</scope>
 </dependency>
 
diff --git a/spring-xsuaa-test/pom.xml b/spring-xsuaa-test/pom.xml
index 46a14379..5a3ca13c 100644
--- a/spring-xsuaa-test/pom.xml
+++ b/spring-xsuaa-test/pom.xml
@@ -9,7 +9,7 @@
 	<parent>
 		<groupId>com.sap.cloud.security.xsuaa</groupId>
 		<artifactId>parent</artifactId>
-		<version>2.10.3</version>
+		<version>2.10.4</version>
 	</parent>
 
 	<artifactId>spring-xsuaa-test</artifactId>
diff --git a/spring-xsuaa/src/test/java/com/sap/cloud/security/xsuaa/XsuaaServicesParserTest.java b/spring-xsuaa/src/test/java/com/sap/cloud/security/xsuaa/XsuaaServicesParserTest.java
index 904291b3..b711d002 100644
--- a/spring-xsuaa/src/test/java/com/sap/cloud/security/xsuaa/XsuaaServicesParserTest.java
+++ b/spring-xsuaa/src/test/java/com/sap/cloud/security/xsuaa/XsuaaServicesParserTest.java
@@ -39,4 +39,15 @@ public class XsuaaServicesParserTest {
 		Properties properties = cut.parseCredentials();
 		assertThat(properties.getProperty("clientid")).isEqualTo("client-id");
 	}
+
+	@Test
+	public void acceptOtherVcapServicesProperties() throws IOException {
+		String vcapWithAddProperties = "{\"xsuaa\":[{\"credentials\":{\"apiurl\":\"https://api.mydomain.com\",\"tenantid\":\"tenant-id\",\"clientid\":\"client-id\"},\"tags\":[\"xsuaa\"]}]}";
+		XsuaaServicesParser cut = new XsuaaServicesParser(vcapWithAddProperties);
+		Properties properties = cut.parseCredentials();
+		assertThat(properties.getProperty("apiurl")).isEqualTo("https://api.mydomain.com");
+		assertThat(properties.containsKey("apiurl")).isTrue();
+		assertThat(properties.getProperty("tenantid")).isEqualTo("tenant-id");
+		assertThat(properties.getProperty("clientid")).isEqualTo("client-id");
+	}
 }
diff --git a/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/DefaultOAuth2TokenServiceTest.java b/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/DefaultOAuth2TokenServiceTest.java
index 244a774d..1b82121b 100644
--- a/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/DefaultOAuth2TokenServiceTest.java
+++ b/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/DefaultOAuth2TokenServiceTest.java
@@ -40,9 +40,10 @@ public class DefaultOAuth2TokenServiceTest {
 
 	private static final String ACCESS_TOKEN = "abc123";
 	private static final String REFRESH_TOKEN = "def456";
+	private static final String TOKEN_TYPE = "bearer";
 	private static final String VALID_JSON_RESPONSE = String
-			.format("{expires_in: 10000, access_token: %s, refresh_token: %s}",
-					ACCESS_TOKEN, REFRESH_TOKEN);
+			.format("{expires_in: 10000, access_token: %s, refresh_token: %s, token_type: %s}",
+					ACCESS_TOKEN, REFRESH_TOKEN, TOKEN_TYPE);
 	private static final URI TOKEN_ENDPOINT_URI = URI.create("https://subdomain.myauth.server.com/oauth/token");
 
 	private CloseableHttpClient mockHttpClient;
@@ -74,6 +75,7 @@ public class DefaultOAuth2TokenServiceTest {
 		assertThat(re.getAccessToken()).isEqualTo(ACCESS_TOKEN);
 		assertThat(re.getRefreshToken()).isEqualTo(REFRESH_TOKEN);
 		assertThat(re.getExpiredAt()).isAfter(Instant.now());
+		assertThat(re.getTokenType()).isEqualTo(TOKEN_TYPE);
 	}
 
 	@Test
diff --git a/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/OAuth2TokenResponseTest.java b/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/OAuth2TokenResponseTest.java
index f93d9538..61169966 100644
--- a/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/OAuth2TokenResponseTest.java
+++ b/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/OAuth2TokenResponseTest.java
@@ -13,6 +13,7 @@ import java.util.Date;
 import java.util.concurrent.TimeUnit;
 
 import static org.hamcrest.CoreMatchers.allOf;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertThat;
 
 public class OAuth2TokenResponseTest {
@@ -42,6 +43,13 @@ public class OAuth2TokenResponseTest {
 				OrderingComparison.lessThanOrEqualTo(maxExpireDate)));
 	}
 
+	@Test
+	public void getTokenType() {
+		OAuth2TokenResponse tokenResponse = new OAuth2TokenResponse("accessToken", 47299, null, "bearer");
+		assertEquals("bearer", tokenResponse.getTokenType());
+		assertEquals("accessToken", tokenResponse.getAccessToken());
+	}
+
 	private Instant getCurrentInstant() {
 		return Instant.ofEpochMilli(System.currentTimeMillis());
 	}
diff --git a/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceClientCredentialsTest.java b/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceClientCredentialsTest.java
index 7806f5ca..d0c2b184 100644
--- a/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceClientCredentialsTest.java
+++ b/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceClientCredentialsTest.java
@@ -5,22 +5,6 @@
  */
 package com.sap.cloud.security.xsuaa.client;
 
-import static com.sap.cloud.security.xsuaa.client.OAuth2TokenServiceConstants.ACCESS_TOKEN;
-import static com.sap.cloud.security.xsuaa.client.OAuth2TokenServiceConstants.EXPIRES_IN;
-import static com.sap.cloud.security.xsuaa.client.OAuth2TokenServiceConstants.GRANT_TYPE;
-import static com.sap.cloud.security.xsuaa.client.OAuth2TokenServiceConstants.GRANT_TYPE_CLIENT_CREDENTIALS;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.ArgumentMatchers.argThat;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.eq;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
 import com.sap.cloud.security.config.ClientCredentials;
 import com.sap.cloud.security.config.ClientIdentity;
 import org.junit.Before;
@@ -35,6 +19,19 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.web.client.HttpClientErrorException;
 import org.springframework.web.client.RestOperations;
 
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.sap.cloud.security.xsuaa.client.OAuth2TokenServiceConstants.*;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.eq;
+
 @RunWith(MockitoJUnitRunner.class)
 public class XsuaaOAuth2TokenServiceClientCredentialsTest {
 
@@ -55,6 +52,7 @@ public class XsuaaOAuth2TokenServiceClientCredentialsTest {
 		responseMap = new HashMap<>();
 		responseMap.putIfAbsent(ACCESS_TOKEN, "f529.dd6e30.d454677322aaabb0");
 		responseMap.putIfAbsent(EXPIRES_IN, "43199");
+		responseMap.putIfAbsent(TOKEN_TYPE, "bearer");
 	}
 
 	@Test
@@ -99,6 +97,7 @@ public class XsuaaOAuth2TokenServiceClientCredentialsTest {
 				clientIdentity,
 				null, null);
 		assertThat(accessToken.getAccessToken(), is(responseMap.get(ACCESS_TOKEN)));
+		assertThat(accessToken.getTokenType(), is(responseMap.get(TOKEN_TYPE)));
 		assertNotNull(accessToken.getExpiredAt());
 	}
 
diff --git a/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceJwtBearerTokenTest.java b/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceJwtBearerTokenTest.java
index f5a5d942..baeb5ee5 100644
--- a/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceJwtBearerTokenTest.java
+++ b/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceJwtBearerTokenTest.java
@@ -51,6 +51,7 @@ public class XsuaaOAuth2TokenServiceJwtBearerTokenTest {
 		response = new HashMap<>();
 		response.putIfAbsent(ACCESS_TOKEN, "f529.dd6e30.d454677322aaabb0");
 		response.putIfAbsent(EXPIRES_IN, "43199");
+		response.putIfAbsent(TOKEN_TYPE, "bearer");
 		when(mockRestOperations.postForEntity(any(), any(), any()))
 				.thenReturn(ResponseEntity.status(200).body(response));
 		optionalParameters = new HashMap<>();
@@ -161,6 +162,7 @@ public class XsuaaOAuth2TokenServiceJwtBearerTokenTest {
 				jwtToken, null, null);
 
 		assertThat(actualResponse.getAccessToken()).isEqualTo(response.get(ACCESS_TOKEN));
+		assertThat(actualResponse.getTokenType()).isEqualTo(response.get(TOKEN_TYPE));
 		assertThat(actualResponse.getExpiredAt()).isNotNull();
 	}
 
diff --git a/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServicePasswordTest.java b/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServicePasswordTest.java
index 6bc37e2a..b4301290 100644
--- a/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServicePasswordTest.java
+++ b/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServicePasswordTest.java
@@ -54,6 +54,7 @@ public class XsuaaOAuth2TokenServicePasswordTest {
 		response = new HashMap();
 		response.putIfAbsent(ACCESS_TOKEN, "f529.dd6e30.d454677322aaabb0");
 		response.putIfAbsent(EXPIRES_IN, "43199");
+		response.putIfAbsent(TOKEN_TYPE, "bearer");
 		when(mockRestOperations.postForEntity(any(), any(), any()))
 				.thenReturn(ResponseEntity.status(200).body(response));
 		optionalParameters = new HashMap<>();
@@ -175,7 +176,7 @@ public class XsuaaOAuth2TokenServicePasswordTest {
 				username, password, null, null);
 
 		assertThat(actualResponse.getAccessToken()).isEqualTo(response.get(ACCESS_TOKEN));
-
+		assertThat(actualResponse.getTokenType()).isEqualTo(response.get(TOKEN_TYPE));
 		assertThat(actualResponse.getExpiredAtDate()).isNotNull();
 	}
 
diff --git a/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceRefreshTokenTest.java b/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceRefreshTokenTest.java
index 2099dbe4..acff2b32 100644
--- a/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceRefreshTokenTest.java
+++ b/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceRefreshTokenTest.java
@@ -5,10 +5,7 @@
  */
 package com.sap.cloud.security.xsuaa.client;
 
-import static com.sap.cloud.security.xsuaa.client.OAuth2TokenServiceConstants.ACCESS_TOKEN;
-import static com.sap.cloud.security.xsuaa.client.OAuth2TokenServiceConstants.EXPIRES_IN;
-import static com.sap.cloud.security.xsuaa.client.OAuth2TokenServiceConstants.GRANT_TYPE_REFRESH_TOKEN;
-import static com.sap.cloud.security.xsuaa.client.OAuth2TokenServiceConstants.REFRESH_TOKEN;
+import static com.sap.cloud.security.xsuaa.client.OAuth2TokenServiceConstants.*;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertNotNull;
@@ -58,6 +55,7 @@ public class XsuaaOAuth2TokenServiceRefreshTokenTest {
 		responseMap.put(REFRESH_TOKEN, "2170b564228448c6aed8b1ddfdb8bf53-r");
 		responseMap.put(ACCESS_TOKEN, "f529.dd6e30.d454677322aaabb0");
 		responseMap.put(EXPIRES_IN, "43199");
+		responseMap.put(TOKEN_TYPE, "bearer");
 	}
 
 	@Test
@@ -106,6 +104,7 @@ public class XsuaaOAuth2TokenServiceRefreshTokenTest {
 				refreshToken, null);
 		assertThat(accessToken.getRefreshToken(), is(responseMap.get(REFRESH_TOKEN)));
 		assertThat(accessToken.getAccessToken(), is(responseMap.get(ACCESS_TOKEN)));
+		assertThat(accessToken.getTokenType(), is(responseMap.get(TOKEN_TYPE)));
 		assertNotNull(accessToken.getExpiredAt());
 	}
 }
\ No newline at end of file
diff --git a/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceUserTokenTest.java b/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceUserTokenTest.java
index e8a3d3bd..76d284e7 100644
--- a/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceUserTokenTest.java
+++ b/token-client/src/test/java/com/sap/cloud/security/xsuaa/client/XsuaaOAuth2TokenServiceUserTokenTest.java
@@ -5,21 +5,6 @@
  */
 package com.sap.cloud.security.xsuaa.client;
 
-import static com.sap.cloud.security.xsuaa.client.OAuth2TokenServiceConstants.ACCESS_TOKEN;
-import static com.sap.cloud.security.xsuaa.client.OAuth2TokenServiceConstants.EXPIRES_IN;
-import static com.sap.cloud.security.xsuaa.client.OAuth2TokenServiceConstants.REFRESH_TOKEN;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.ArgumentMatchers.argThat;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.eq;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
 import com.sap.cloud.security.config.ClientCredentials;
 import com.sap.cloud.security.config.ClientIdentity;
 import org.junit.Before;
@@ -35,6 +20,19 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.web.client.HttpClientErrorException;
 import org.springframework.web.client.RestOperations;
 
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.sap.cloud.security.xsuaa.client.OAuth2TokenServiceConstants.*;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.eq;
+
 @RunWith(MockitoJUnitRunner.class)
 public class XsuaaOAuth2TokenServiceUserTokenTest {
 
@@ -57,6 +55,7 @@ public class XsuaaOAuth2TokenServiceUserTokenTest {
 		responseMap.put(REFRESH_TOKEN, "2170b564228448c6aed8b1ddfdb8bf53-r");
 		responseMap.put(ACCESS_TOKEN, "4d841646fcc340f59b1b7b43df4b050d"); // opaque access token
 		responseMap.put(EXPIRES_IN, "43199");
+		responseMap.put(TOKEN_TYPE, "bearer");
 	}
 
 	@Test
@@ -111,6 +110,7 @@ public class XsuaaOAuth2TokenServiceUserTokenTest {
 				userTokenToBeExchanged, null, null);
 		assertThat(accessToken.getRefreshToken(), is(responseMap.get(REFRESH_TOKEN)));
 		assertThat(accessToken.getAccessToken(), is(responseMap.get(ACCESS_TOKEN)));
+		assertThat(accessToken.getTokenType(), is(responseMap.get(TOKEN_TYPE)));
 		assertNotNull(accessToken.getExpiredAt());
 	}