You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2020/03/13 07:02:05 UTC

[cxf] branch master updated: CXF-8240 - STSClient produces wrong element order for TokenType

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new b7a8df7  CXF-8240 - STSClient produces wrong element order for TokenType
b7a8df7 is described below

commit b7a8df71b02b8d84f5591eee429edc2f02dc3632
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Fri Mar 13 07:01:36 2020 +0000

    CXF-8240 - STSClient produces wrong element order for TokenType
---
 .../cxf/ws/security/trust/AbstractSTSClient.java   | 35 ++++++++++++----------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
index 3986576..11d38f8 100755
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
@@ -802,6 +802,10 @@ public abstract class AbstractSTSClient implements Configurable, InterceptorProv
             sendKeyType = false;
         }
 
+        if (sptt == null) {
+            addTokenType(writer);
+        }
+
         addRequestType(requestType, writer);
         if (enableAppliesTo) {
             addAppliesTo(writer, appliesTo);
@@ -809,18 +813,20 @@ public abstract class AbstractSTSClient implements Configurable, InterceptorProv
 
         addClaims(writer);
 
+        if (isSecureConv || enableLifetime) {
+            addLifetime(writer);
+        }
+
+        // Write out renewal semantics
+        writeRenewalSemantics(writer);
+
         Element onBehalfOfToken = getOnBehalfOfToken();
         if (onBehalfOfToken != null) {
             writer.writeStartElement("wst", "OnBehalfOf", namespace);
             StaxUtils.copy(onBehalfOfToken, writer);
             writer.writeEndElement();
         }
-        if (sptt == null) {
-            addTokenType(writer);
-        }
-        if (isSecureConv || enableLifetime) {
-            addLifetime(writer);
-        }
+
         if (keyTypeTemplate == null) {
             keyTypeTemplate = writeKeyType(writer, keyType);
         }
@@ -858,9 +864,6 @@ public abstract class AbstractSTSClient implements Configurable, InterceptorProv
             writer.writeEndElement();
         }
 
-        // Write out renewal semantics
-        writeRenewalSemantics(writer);
-
         Element customElement = getCustomContent();
         if (customElement != null) {
             StaxUtils.copy(customElement, writer);
@@ -1070,14 +1073,15 @@ public abstract class AbstractSTSClient implements Configurable, InterceptorProv
             tokenType = STSUtils.getTokenTypeSCT(namespace);
         }
 
+        if (sptt == null) {
+            addTokenType(writer);
+        }
+
         addRequestType("/Renew", writer);
         if (enableAppliesTo) {
             addAppliesTo(writer, tok.getIssuerAddress());
         }
 
-        if (sptt == null) {
-            addTokenType(writer);
-        }
         if (isSecureConv || enableLifetime) {
             addLifetime(writer);
         }
@@ -1146,14 +1150,15 @@ public abstract class AbstractSTSClient implements Configurable, InterceptorProv
         W3CDOMStreamWriter writer = new W3CDOMStreamWriter();
         writer.writeStartElement("wst", "RequestSecurityToken", namespace);
         writer.writeNamespace("wst", namespace);
-        writer.writeStartElement("wst", "RequestType", namespace);
-        writer.writeCharacters(namespace + "/Validate");
-        writer.writeEndElement();
 
         writer.writeStartElement("wst", "TokenType", namespace);
         writer.writeCharacters(tokentype);
         writer.writeEndElement();
 
+        writer.writeStartElement("wst", "RequestType", namespace);
+        writer.writeCharacters(namespace + "/Validate");
+        writer.writeEndElement();
+
         if (tokentype.endsWith("/RSTR/Status")) {
             addClaims(writer);