cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1174872 - in /cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider: SecurityTokenService.java SecurityTokenServiceImpl.java SecurityTokenServiceProvider.java operation/IssueSingleOperation.java
Date Fri, 23 Sep 2011 16:28:54 GMT
Author: coheigea
Date: Fri Sep 23 16:28:53 2011
New Revision: 1174872

URL: http://svn.apache.org/viewvc?rev=1174872&view=rev
Log:
Add support to the STS framework to issue a token without returning a collection type.

Added:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/operation/IssueSingleOperation.java
Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenService.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceImpl.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceProvider.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenService.java?rev=1174872&r1=1174871&r2=1174872&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenService.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenService.java
Fri Sep 23 16:28:53 2011
@@ -68,10 +68,22 @@ public interface SecurityTokenService {
                   targetNamespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512")
         RequestSecurityTokenType request
     );
+    
+    @WebResult(name = "RequestSecurityTokenResponse",
+              targetNamespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512",
+              partName = "response")
+    @Action(input = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue", 
+            output = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTRC/IssueFinal")
+    @WebMethod(operationName = "Issue")
+    RequestSecurityTokenResponseType issueSingle(
+        @WebParam(partName = "request",
+                  name = "RequestSecurityToken", 
+                  targetNamespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512")
+        RequestSecurityTokenType request
+    );
 
     @WebResult(name = "RequestSecurityTokenResponse", 
                targetNamespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512", 
-               
                partName = "response")
     @Action(input = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Cancel", 
             output = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/CancelFinal")

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceImpl.java?rev=1174872&r1=1174871&r2=1174872&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceImpl.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceImpl.java
Fri Sep 23 16:28:53 2011
@@ -33,6 +33,7 @@ import org.apache.cxf.ws.security.sts.pr
 import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType;
 import org.apache.cxf.ws.security.sts.provider.operation.CancelOperation;
 import org.apache.cxf.ws.security.sts.provider.operation.IssueOperation;
+import org.apache.cxf.ws.security.sts.provider.operation.IssueSingleOperation;
 import org.apache.cxf.ws.security.sts.provider.operation.KeyExchangeTokenOperation;
 import org.apache.cxf.ws.security.sts.provider.operation.RenewOperation;
 import org.apache.cxf.ws.security.sts.provider.operation.RequestCollectionOperation;
@@ -43,6 +44,7 @@ public class SecurityTokenServiceImpl im
 
     private CancelOperation cancelOperation;
     private IssueOperation issueOperation;
+    private IssueSingleOperation issueSingleOperation;
     private KeyExchangeTokenOperation keyExchangeTokenOperation;
     private RenewOperation renewOperation;
     private RequestCollectionOperation requestCollectionOperation;
@@ -58,6 +60,10 @@ public class SecurityTokenServiceImpl im
     public void setIssueOperation(IssueOperation issueOperation) {
         this.issueOperation = issueOperation;
     }
+    
+    public void setIssueSingleOperation(IssueSingleOperation issueSingleOperation) {
+        this.issueSingleOperation = issueSingleOperation;
+    }
 
     public void setKeyExchangeTokenOperation(
             KeyExchangeTokenOperation keyExchangeTokenOperation) {
@@ -109,6 +115,14 @@ public class SecurityTokenServiceImpl im
         }
         return issueOperation.issue(request, context);
     }
+    
+    public RequestSecurityTokenResponseType issueSingle(
+            RequestSecurityTokenType request) {
+        if (issueSingleOperation == null) {
+            throwUnsupportedOperation("IssueSingle");
+        }
+        return issueSingleOperation.issueSingle(request, context);
+    }
 
     public RequestSecurityTokenResponseType cancel(
             RequestSecurityTokenType request) {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceProvider.java?rev=1174872&r1=1174871&r2=1174872&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceProvider.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceProvider.java
Fri Sep 23 16:28:53 2011
@@ -51,6 +51,7 @@ import org.apache.cxf.ws.security.sts.pr
 import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType;
 import org.apache.cxf.ws.security.sts.provider.operation.CancelOperation;
 import org.apache.cxf.ws.security.sts.provider.operation.IssueOperation;
+import org.apache.cxf.ws.security.sts.provider.operation.IssueSingleOperation;
 import org.apache.cxf.ws.security.sts.provider.operation.KeyExchangeTokenOperation;
 import org.apache.cxf.ws.security.sts.provider.operation.RenewOperation;
 import org.apache.cxf.ws.security.sts.provider.operation.RequestCollectionOperation;
@@ -118,6 +119,7 @@ public class SecurityTokenServiceProvide
     
     private CancelOperation cancelOperation;
     private IssueOperation issueOperation;
+    private IssueSingleOperation issueSingleOperation;
     private KeyExchangeTokenOperation keyExchangeTokenOperation;
     private RenewOperation renewOperation;
     private RequestCollectionOperation requestCollectionOperation;
@@ -147,6 +149,24 @@ public class SecurityTokenServiceProvide
         this.issueOperation = issueOperation;
         operationMap.put(WSTRUST_REQUESTTYPE_ISSUE, issueOperation);
     }
+    
+    /**
+     * Setting an IssueSingleOperation instance will override the default behaviour of issuing
+     * a token in a RequestSecurityTokenResponseCollection
+     */
+    public void setIssueSingleOperation(IssueSingleOperation issueSingleOperation) {
+        this.issueSingleOperation = issueSingleOperation;
+        Method m;
+        try {
+            m = IssueSingleOperation.class.getDeclaredMethod("issueSingle", 
+                    RequestSecurityTokenType.class, 
+                    WebServiceContext.class);
+            OPERATION_METHODS.put(WSTRUST_REQUESTTYPE_ISSUE, m);
+            operationMap.put(WSTRUST_REQUESTTYPE_ISSUE, issueSingleOperation);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 
     public void setKeyExchangeTokenOperation(
             KeyExchangeTokenOperation keyExchangeTokenOperation) {
@@ -271,6 +291,10 @@ public class SecurityTokenServiceProvide
     public IssueOperation getIssueOperation() {
         return issueOperation;
     }
+    
+    public IssueSingleOperation getIssueSingleOperation() {
+        return issueSingleOperation;
+    }
 
     public KeyExchangeTokenOperation getKeyExchangeTokenOperation() {
         return keyExchangeTokenOperation;

Added: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/operation/IssueSingleOperation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/operation/IssueSingleOperation.java?rev=1174872&view=auto
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/operation/IssueSingleOperation.java
(added)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/operation/IssueSingleOperation.java
Fri Sep 23 16:28:53 2011
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.security.sts.provider.operation;
+
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenResponseType;
+import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType;
+
+public interface IssueSingleOperation {
+
+    RequestSecurityTokenResponseType issueSingle(
+            RequestSecurityTokenType request,
+            WebServiceContext context);
+
+}



Mime
View raw message