Refactoring interface

Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b63c63ff
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b63c63ff
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b63c63ff

Branch: refs/heads/3.1.x-fixes
Commit: b63c63ffeb1f8d4e747ba2e9233be6aa635c00db
Parents: ca0b596
Author: Colm O hEigeartaigh <cohei...@apache.org>
Authored: Wed Feb 10 16:45:25 2016 +0000
Committer: Colm O hEigeartaigh <cohei...@apache.org>
Committed: Wed Feb 10 17:24:33 2016 +0000

----------------------------------------------------------------------
 .../cxf/sts/rest/RESTSecurityTokenService.java  | 11 ++-------
 .../sts/rest/RESTSecurityTokenServiceImpl.java  | 24 +++++++++-----------
 .../cxf/systest/sts/rest/STSRESTTest.java       |  3 ++-
 3 files changed, 15 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b63c63ff/services/sts/sts-core/src/main/java/org/apache/cxf/sts/rest/RESTSecurityTokenService.java
----------------------------------------------------------------------
diff --git 
a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/rest/RESTSecurityTokenService.java
 
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/rest/RESTSecurityTokenService.java
index 0967b10..3d5ed24 100644
--- 
a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/rest/RESTSecurityTokenService.java
+++ 
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/rest/RESTSecurityTokenService.java
@@ -64,15 +64,8 @@ public interface RESTSecurityTokenService {
     })
     Response getToken(@PathParam("tokenType") String tokenType, 
@QueryParam("keyType") String keyType,
         @QueryParam("claim") List<String> requestedClaims,
-        @QueryParam("appliesTo") String appliesTo);
-    
-    @GET
-    @Path("ws-trust/{tokenType}")
-    @Produces({
-        MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON
-    })
-    Response getTokenViaWSTrust(@PathParam("tokenType") String tokenType, 
@QueryParam("keyType") String keyType,
-        @QueryParam("claim") List<String> requestedClaims, 
@QueryParam("appliesTo") String appliesTo);
+        @QueryParam("appliesTo") String appliesTo,
+        @QueryParam("wstrustResponse") @DefaultValue("false") boolean 
wstrustResponse);
     
     @POST
     @Produces({

http://git-wip-us.apache.org/repos/asf/cxf/blob/b63c63ff/services/sts/sts-core/src/main/java/org/apache/cxf/sts/rest/RESTSecurityTokenServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/rest/RESTSecurityTokenServiceImpl.java
 
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/rest/RESTSecurityTokenServiceImpl.java
index 2ce24bc..6d283a5 100644
--- 
a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/rest/RESTSecurityTokenServiceImpl.java
+++ 
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/rest/RESTSecurityTokenServiceImpl.java
@@ -93,9 +93,19 @@ public class RESTSecurityTokenServiceImpl extends 
SecurityTokenServiceImpl imple
     private boolean requestClaimsOptional = true;
 
     @Override
-    public Response getToken(String tokenType, String keyType, List<String> 
requestedClaims, String appliesTo) {
+    public Response getToken(String tokenType, String keyType, 
+                             List<String> requestedClaims, String appliesTo,
+                             boolean wstrustResponse) {
         RequestSecurityTokenResponseType response = 
             issueToken(tokenType, keyType, requestedClaims, appliesTo);
+        
+        if (wstrustResponse) {
+            JAXBElement<RequestSecurityTokenResponseType> jaxbResponse = 
+                
QNameConstants.WS_TRUST_FACTORY.createRequestSecurityTokenResponse(response);
+            
+            return Response.ok(jaxbResponse).build();
+        }
+        
         RequestedSecurityTokenType requestedToken = 
getRequestedSecurityToken(response);
         
         if ("jwt".equals(tokenType)) {
@@ -106,18 +116,6 @@ public class RESTSecurityTokenServiceImpl extends 
SecurityTokenServiceImpl imple
         }
     }
     
-    @Override
-    public Response getTokenViaWSTrust(String tokenType, String keyType, 
-                                       List<String> requestedClaims, String 
appliesTo) {
-        RequestSecurityTokenResponseType response = 
-            issueToken(tokenType, keyType, requestedClaims, appliesTo);
-        
-        JAXBElement<RequestSecurityTokenResponseType> jaxbResponse = 
-            
QNameConstants.WS_TRUST_FACTORY.createRequestSecurityTokenResponse(response);
-        
-        return Response.ok(jaxbResponse).build();
-    }
-    
     private RequestedSecurityTokenType 
getRequestedSecurityToken(RequestSecurityTokenResponseType response) {
         for (Object obj : response.getAny()) {
             if (obj instanceof JAXBElement<?>) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/b63c63ff/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/STSRESTTest.java
----------------------------------------------------------------------
diff --git 
a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/STSRESTTest.java
 
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/STSRESTTest.java
index f9ec98c..86655c3 100644
--- 
a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/STSRESTTest.java
+++ 
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/STSRESTTest.java
@@ -423,11 +423,12 @@ public class STSRESTTest extends 
AbstractBusClientServerTestBase {
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
         
-        String address = "https://localhost:"; + STSPORT + 
"/SecurityTokenService/token/ws-trust";
+        String address = "https://localhost:"; + STSPORT + 
"/SecurityTokenService/token";
         WebClient client = WebClient.create(address, busFile.toString());
 
         client.type("application/xml").accept("application/xml");
         client.path("saml2.0");
+        client.query("wstrustResponse", "true");
         
         Response response = client.get();
         RequestSecurityTokenResponseType securityResponse = 

Reply via email to