cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf-fediz git commit: Adding an audience property to the client reg page
Date Thu, 21 Jan 2016 16:59:55 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/master 669232ddc -> 5c354ce09


Adding an audience property to the client reg page


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

Branch: refs/heads/master
Commit: 5c354ce099a6a3f84e03b201f96d7f324d578a12
Parents: 669232d
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Thu Jan 21 16:59:38 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Thu Jan 21 16:59:38 2016 +0000

----------------------------------------------------------------------
 .../service/oidc/ClientRegistrationService.java | 22 ++++++++++++++++++--
 .../webapp/WEB-INF/views/registerClient.jsp     |  8 ++++++-
 2 files changed, 27 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/5c354ce0/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/ClientRegistrationService.java
----------------------------------------------------------------------
diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/ClientRegistrationService.java
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/ClientRegistrationService.java
index 4d22ac0..ff01d41 100644
--- a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/ClientRegistrationService.java
+++ b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/ClientRegistrationService.java
@@ -19,12 +19,15 @@
 
 package org.apache.cxf.fediz.service.oidc;
 
+import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -186,8 +189,10 @@ public class ClientRegistrationService {
     @Produces(MediaType.TEXT_HTML)
     @Path("/")
     public Collection<Client> registerForm(@FormParam("client_name") String appName,
-        @FormParam("client_type") String appType, @FormParam("client_redirectURI") String
redirectURI,
-        @FormParam("client_homeRealm") String homeRealm) {
+                                           @FormParam("client_type") String appType, 
+                                           @FormParam("client_audience") String audience,
+                                           @FormParam("client_redirectURI") String redirectURI,
+                                           @FormParam("client_homeRealm") String homeRealm)
{
         //TODO Check for mandatory parameters
         
         String clientId = generateClientId();
@@ -211,6 +216,19 @@ public class ClientRegistrationService {
             newClient.setRegisteredScopes(new ArrayList<String>(clientScopes.keySet()));
         }
         
+        if (!StringUtils.isEmpty(audience)) {
+            String[] auds = audience.trim().split(" ");
+            List<String> registeredAuds = new LinkedList<String>();
+            for (String aud : auds) {
+                // make sure it is a proper URI
+                String theAud = URI.create(aud.trim()).toString();
+                registeredAuds.add(theAud);
+            }
+            if (!registeredAuds.isEmpty()) {
+                newClient.setRegisteredAudiences(registeredAuds);
+            }
+        }
+        
         return registerNewClient(newClient);
     }
 

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/5c354ce0/services/oidc/src/main/webapp/WEB-INF/views/registerClient.jsp
----------------------------------------------------------------------
diff --git a/services/oidc/src/main/webapp/WEB-INF/views/registerClient.jsp b/services/oidc/src/main/webapp/WEB-INF/views/registerClient.jsp
index 28c37e6..5530991 100644
--- a/services/oidc/src/main/webapp/WEB-INF/views/registerClient.jsp
+++ b/services/oidc/src/main/webapp/WEB-INF/views/registerClient.jsp
@@ -79,12 +79,18 @@ input, select, button {
 				</select>
 			</div>
 			<div class="form-line">
-				<label for="client_redirectURI" id="label_redirect" class="form-label"> Redirect
URI </label>
+				<label for="client_redirectURI" id="label_redirect" class="form-label"> Redirect
URL </label>
 				<input type="text" value="" size="40" name="client_redirectURI"
 					placeholder="URL of the client to consume OIDC service response"
 					id="input_6" data-type="input-textbox" />
 			</div>
 			<div class="form-line">
+				<label for="client_audience" id="label_redirect" class="form-label"> Audience URL
</label>
+				<input type="text" value="" size="40" name="client_audience"
+					placeholder="URL of the server the tokens will be restricted to"
+					id="input_7" data-type="input-textbox" />
+			</div>
+			<div class="form-line">
 				<label for="client_homeRealm" id="label_homeRealm" class="form-label"> Home Realm
</label>
 				<select name="client_homeRealm" id="input_homeRealm">
 					<option value="" selected>Default - User selection at login</option>


Mime
View raw message