[java-identity-provider COMMIT] in /trunk: idp-conf/src/main/resources/views/login.vm idp-ui/src/main/java/net/shibbo...

noreply at shibboleth.net noreply at shibboleth.net
Wed Aug 13 12:27:42 EDT 2014


Author: rdw
Date: Wed Aug 13 12:27:42 2014
New Revision: 6420

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6420&view=rev
Log:
IDP-245 Get rid of all that nonsense about default values and do the defaulting in velocity if we need to

Modified:
    trunk/idp-conf/src/main/resources/views/login.vm
    trunk/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java
    trunk/idp-ui/src/test/java/net/shibboleth/idp/ui/context/RelyingPartyUIContextTest.java

Modified: trunk/idp-conf/src/main/resources/views/login.vm
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/main/resources/views/login.vm?rev=6420&r1=6419&r2=6420&view=diff
==============================================================================
--- trunk/idp-conf/src/main/resources/views/login.vm (original)
+++ trunk/idp-conf/src/main/resources/views/login.vm Wed Aug 13 12:27:42 2014
@@ -44,7 +44,7 @@
               #end
 
               <legend>
-                 Log in to $rpUIContext.getServiceName("Anonymous Service");
+                 Log in to $rpUIContext.getServiceName()
               </legend>
 
               <section>
@@ -78,17 +78,19 @@
               //    added SP information.
               //
               //    Documentation: 
-              //      https://wiki.shibboleth.net/confluence/display/SHIB2/IdPAuthUserPassLoginPage
+              //      https://wiki.shibboleth.net/confluence/display/SHIB2/IdPAuthUserPassLoginPage  TODO
               //
               //    Example:
             -->
             #set ($logo = $rpUIContext.getLogo())
             #if ($logo)
-                <img src= "$encoder.encodeForHTMLAttribute($logo)" alt="logo for $rpUIContext.getServiceName("")"/>
+                <img src= "$encoder.encodeForHTMLAttribute($logo)" alt="logo for $rpUIContext.getServiceName()"/>
             #end
-			$rpUIContext.getServiceDescription("")
-			          
-
+            #set ($desc = $rpUIContext.getServiceDescription())
+            #if ($desc)
+              $desc
+            #end
+            
           </div>
           <div class="column two">
             <ul class="list list-help">

Modified: trunk/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java?rev=6420&r1=6419&r2=6420&view=diff
==============================================================================
--- trunk/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java (original)
+++ trunk/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java Wed Aug 13 12:27:42 2014
@@ -170,14 +170,13 @@
      * 
      * @param url the url to look at
      * @param acceptableSchemes the schemes to test against
-     * @param defaultValue what to return if the test fails
-     * @return the input or the default as appropriate.
+     * @return the input or null as appropriate.
      */
     @Nullable private String policeURL(@Nullable final String url,
-            @Nonnull @NotEmpty final List<String> acceptableSchemes, @Nullable final String defaultValue) {
+            @Nonnull @NotEmpty final List<String> acceptableSchemes) {
         if (null == url) {
-            log.trace("Empty Value - returning '{}", defaultValue);
-            return defaultValue;
+            log.trace("Empty Value - returning null");
+            return null;
         }
 
         try {
@@ -190,12 +189,12 @@
                 }
             }
 
-            log.warn("The logo URL '{}' contained an invalid scheme (expected '{}'), returning default of '{}'", url,
-                    acceptableSchemes, defaultValue);
-            return defaultValue;
+            log.warn("The logo URL '{}' contained an invalid scheme (expected '{}'), returning null", url,
+                    acceptableSchemes);
+            return null;
         } catch (URISyntaxException e) {
-            log.warn("The logo URL '{}' contained was not a URL, returning default of '{}'", url, defaultValue);
-            return defaultValue;
+            log.warn("The logo URL '{}' contained was not a URL, returning null", url);
+            return null;
         }
     }
 
@@ -206,18 +205,17 @@
      * @return the input or the default as appropriate
      */
     protected String policeURLLogo(@Nullable final String url) {
-        return policeURL(url, Arrays.asList("http", "https", "data"), null);
+        return policeURL(url, Arrays.asList("http", "https", "data"));
     }
 
     /**
      * Police a url found for non logo data.
      * 
      * @param url the url to look at
-     * @param defaultValue what to return if the test fails
      * @return the input or the default as appropriate
      */
-    protected String policeURLNonLogo(@Nullable final String url, @Nullable final String defaultValue) {
-        return policeURL(url, Arrays.asList("http", "https", "mailto"), defaultValue);

[... 373 lines stripped ...]


More information about the commits mailing list