Better algorithm for determining SSO profile in effect for a given request. Default...
[java-idp.git] / src / edu / internet2 / middleware / shibboleth / common / ServiceProviderMapper.java
index 472fc31..ba44ab0 100644 (file)
@@ -225,6 +225,7 @@ public class ServiceProviderMapper {
                private boolean passThruIsOverriden = false;
                private boolean forceAttributePush = false;
                private boolean forceAttributeNoPush = false;
                private boolean passThruIsOverriden = false;
                private boolean forceAttributePush = false;
                private boolean forceAttributeNoPush = false;
+               private boolean defaultToPOST = true;
 
                public RelyingPartyImpl(Element partyConfig, IdPConfig globalConfig, Credentials credentials,
                                NameMapper nameMapper) throws ServiceProviderMapperException {
 
                public RelyingPartyImpl(Element partyConfig, IdPConfig globalConfig, Credentials credentials,
                                NameMapper nameMapper) throws ServiceProviderMapperException {
@@ -275,6 +276,17 @@ public class ServiceProviderMapper {
                                passThruIsOverriden = true;
                        }
 
                                passThruIsOverriden = true;
                        }
 
+                       // SSO profile defaulting
+                       attribute = ((Element) partyConfig).getAttribute("defaultToPOSTProfile");
+                       if (attribute != null && !attribute.equals("")) {
+                               defaultToPOST = Boolean.valueOf(attribute).booleanValue();
+                               if (defaultToPOST) {
+                                       log.debug("Relying party defaults to POST profile.");
+                               } else {
+                                       log.debug("Relying party defaults to Artifact profile.");
+                               }
+                       }
+
                        // Determine whether or not we are forcing attribute push on or off
                        String forcePush = ((Element) partyConfig).getAttribute("forceAttributePush");
                        String forceNoPush = ((Element) partyConfig).getAttribute("forceAttributeNoPush");
                        // Determine whether or not we are forcing attribute push on or off
                        String forcePush = ((Element) partyConfig).getAttribute("forceAttributePush");
                        String forceNoPush = ((Element) partyConfig).getAttribute("forceAttributeNoPush");
@@ -406,6 +418,11 @@ public class ServiceProviderMapper {
                        return forceAttributeNoPush;
                }
 
                        return forceAttributeNoPush;
                }
 
+               public boolean defaultToPOSTProfile() {
+
+                       return defaultToPOST;
+               }
+
                /**
                 * Default identity provider implementation.
                 * 
                /**
                 * Default identity provider implementation.
                 * 
@@ -438,6 +455,7 @@ public class ServiceProviderMapper {
                                return credential;
                        }
                }
                                return credential;
                        }
                }
+
        }
 
        /**
        }
 
        /**
@@ -505,6 +523,11 @@ public class ServiceProviderMapper {
 
                        return wrapped.forceAttributeNoPush();
                }
 
                        return wrapped.forceAttributeNoPush();
                }
+
+               public boolean defaultToPOSTProfile() {
+
+                       return wrapped.defaultToPOSTProfile();
+               }
        }
 
        /**
        }
 
        /**
@@ -572,6 +595,11 @@ public class ServiceProviderMapper {
 
                        return false;
                }
 
                        return false;
                }
+
+               public boolean defaultToPOSTProfile() {
+
+                       return true;
+               }
        }
 
        /**
        }
 
        /**