cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [4/6] cxf git commit: Refactoring interface
Date Wed, 10 Feb 2016 17:24:14 GMT
Refactoring interface


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

Branch: refs/heads/master
Commit: dae3e1c83766e973ec09be850ce7d426eb586da2
Parents: acd0e23
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Wed Feb 10 16:45:25 2016 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Wed Feb 10 17:22:03 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/dae3e1c8/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 51291dd..0766862 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/dae3e1c8/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/dae3e1c8/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 = 


Mime
View raw message