[java-identity-provider COMMIT] in /trunk: idp-authn-api/pom.xml idp-authn-api/src/main/java/net/shibboleth/idp/authn...
noreply at shibboleth.net
noreply at shibboleth.net
Thu Dec 10 10:23:22 EST 2015
Author: serac
Date: Thu Dec 10 10:23:22 2015
New Revision: 8022
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=8022&view=rev
Log:
IDP-879 Specify text/plain content type for IE logout response.
https://issues.shibboleth.net/jira/browse/IDP-879
Added eu.bitwalker:UserAgentUtils library and some convenience methods to
UserAgentContext to facilitate user agent detection.
Added:
trunk/idp-authn-api/src/test/java/net/shibboleth/idp/authn/context/UserAgentContextTest.java
Modified:
trunk/idp-authn-api/pom.xml
trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/UserAgentContext.java
trunk/idp-conf/src/main/resources/system/flows/logout/logout-propagation-flow.xml
trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/PopulateLogoutPropagationContext.java
Modified: trunk/idp-authn-api/pom.xml
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/pom.xml?rev=8022&r1=8021&r2=8022&view=diff
==============================================================================
--- trunk/idp-authn-api/pom.xml (original)
+++ trunk/idp-authn-api/pom.xml Thu Dec 10 10:23:22 2015
@@ -45,6 +45,11 @@
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
+ <dependency>
+ <groupId>eu.bitwalker</groupId>
+ <artifactId>UserAgentUtils</artifactId>
+ <version>1.18</version>
+ </dependency>
<!-- Provided Dependencies -->
Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/UserAgentContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/UserAgentContext.java?rev=8022&r1=8021&r2=8022&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/UserAgentContext.java (original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/UserAgentContext.java Thu Dec 10 10:23:22 2015
@@ -19,8 +19,13 @@
import java.net.InetAddress;
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import eu.bitwalker.useragentutils.Browser;
+import eu.bitwalker.useragentutils.OperatingSystem;
+import eu.bitwalker.useragentutils.UserAgent;
+import net.shibboleth.utilities.java.support.logic.Constraint;
import org.opensaml.messaging.context.BaseContext;
/** A context, usually attached to {@link AuthenticationContext}, containing data about the user agent. */
@@ -31,6 +36,10 @@
/** An identification string (such as a User-Agent header). */
@Nullable private String identifier;
+
+ /** Parsed User-Agent. */
+ @Nullable private UserAgent userAgent;
+
/**
* Get the address of the user-agent host.
@@ -63,7 +72,8 @@
}
/**
- * Set the user agent identifier.
+ * Set the user agent identifier. The parsed user agent is available via {@link #getUserAgent()} upon calling
+ * this method.
*
* @param id identifier for the user agent
*
@@ -71,7 +81,46 @@
*/
public UserAgentContext setIdentifier(@Nullable final String id) {
identifier = id;
+ userAgent = new UserAgent(id);
return this;
}
+ /**
+ * Gets the parsed user agent.
+ *
+ * @return Parsed user agent or null if {@link #setIdentifier(String)} has not been called.
+ */
+ @Nullable public UserAgent getUserAgent() {
+ return userAgent;
+ }
+
+ /**
+ * Determines whether this user agent is an instance of the given browser.
+ *
+ * @param browser browser to check.
+ *
+ * @return True if this user agent is an instance of the given browser, false otherwise.
+ */
+ public boolean isInstance(@Nonnull final Browser browser) {
+ Constraint.isNotNull(browser, "Browser cannot be null");
+ if (userAgent == null) {
+ return false;
+ }
+ return userAgent.getBrowser().getGroup().equals(browser) || userAgent.getBrowser().equals(browser);
+ }
+
+ /**
+ * Determines whether this user agent is an instance of the given operating system.
+ *
+ * @param os operating system to check.
+ *
+ * @return True if this user agent is an instance of the given operating system, false otherwise.
+ */
+ public boolean isInstance(@Nonnull final OperatingSystem os) {
+ Constraint.isNotNull(os, "OperatingSystem cannot be null");
+ if (userAgent == null) {
+ return false;
+ }
+ return userAgent.getOperatingSystem().getGroup().equals(os) || userAgent.getOperatingSystem().equals(os);
+ }
}
Modified: trunk/idp-conf/src/main/resources/system/flows/logout/logout-propagation-flow.xml
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/main/resources/system/flows/logout/logout-propagation-flow.xml?rev=8022&r1=8021&r2=8022&view=diff
==============================================================================
[... 50 lines stripped ...]
More information about the commits
mailing list