Package net.shibboleth.idp.authn.context
Class UserAgentContext
java.lang.Object
org.opensaml.messaging.context.BaseContext
net.shibboleth.idp.authn.context.UserAgentContext
- All Implemented Interfaces:
Iterable<BaseContext>
A context containing data about the user agent.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensaml.messaging.context.BaseContext
BaseContext.ContextSetNoRemoveIteratorDecorator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate InetAddress
Address of the user-agent host.private String
An identification string (such as a User-Agent header).private eu.bitwalker.useragentutils.UserAgent
Parsed User-Agent. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the address of the user-agent host.Get the user agent identifier.eu.bitwalker.useragentutils.UserAgent
Gets the parsed user agent.boolean
isInstance
(eu.bitwalker.useragentutils.Browser browser) Determines whether this user agent is an instance of the given browser.boolean
isInstance
(eu.bitwalker.useragentutils.OperatingSystem os) Determines whether this user agent is an instance of the given operating system.setAddress
(InetAddress userAgentAddress) Set the address of the user-agent host.setIdentifier
(String id) Set the user agent identifier.Methods inherited from class org.opensaml.messaging.context.BaseContext
addSubcontext, addSubcontext, clearSubcontexts, containsSubcontext, createSubcontext, getParent, getSubcontext, getSubcontext, getSubcontext, getSubcontext, iterator, removeSubcontext, removeSubcontext, setParent
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
address
Address of the user-agent host. -
identifier
An identification string (such as a User-Agent header). -
userAgent
@Nullable private eu.bitwalker.useragentutils.UserAgent userAgentParsed User-Agent.
-
-
Constructor Details
-
UserAgentContext
public UserAgentContext()
-
-
Method Details
-
getAddress
Get the address of the user-agent host.- Returns:
- address of the user-agent host
-
setAddress
Set the address of the user-agent host.- Parameters:
userAgentAddress
- address of the user-agent host- Returns:
- this context
-
getIdentifier
Get the user agent identifier.- Returns:
- identifier for the user agent
-
setIdentifier
Set the user agent identifier. The parsed user agent is available viagetUserAgent()
upon calling this method.- Parameters:
id
- identifier for the user agent- Returns:
- this context
-
getUserAgent
@Nullable public eu.bitwalker.useragentutils.UserAgent getUserAgent()Gets the parsed user agent.- Returns:
- Parsed user agent or null if
setIdentifier(String)
has not been called.
-
isInstance
public boolean isInstance(@Nonnull eu.bitwalker.useragentutils.Browser browser) Determines whether this user agent is an instance of the given browser.- Parameters:
browser
- browser to check.- Returns:
- True if this user agent is an instance of the given browser, false otherwise.
-
isInstance
public boolean isInstance(@Nonnull eu.bitwalker.useragentutils.OperatingSystem os) Determines whether this user agent is an instance of the given operating system.- Parameters:
os
- operating system to check.- Returns:
- True if this user agent is an instance of the given operating system, false otherwise.
-