Package net.shibboleth.idp.ui.context
Class RelyingPartyUIContext
java.lang.Object
org.opensaml.messaging.context.BaseContext
net.shibboleth.idp.ui.context.RelyingPartyUIContext
- All Implemented Interfaces:
Iterable<BaseContext>
The context which carries the user interface information.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensaml.messaging.context.BaseContext
BaseContext.ContextSetNoRemoveIteratorDecorator, BaseContext.DeprecatedContextClassNameLookAside -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<Locale.LanguageRange>The (statically defined) languages that this user wants to know about.private List<Locale.LanguageRange>The languages that this the Operator want to fall back to.private final org.slf4j.LoggerThe log.private NonnullSupplier<HttpServletRequest>A way of getting the current HTTP request, if available.private ACSUIInfoThe appropriateACSUIInfo.private EntityDescriptorThe appropriateEntityDescriptor.private SPSSODescriptorThe appropriateSPSSODescriptor.private IdPUIInfoThe appropriateIdPUIInfo. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected List<Locale.LanguageRange>Get the browser languages.getContactEmail(String contactType) look for the <ContactPerson> and within that the Email.getContactGivenName(String contactType) look for the <ContactPerson> and within that the GivenName.getContactPerson(ContactPersonTypeEnumeration contactType) Lookup the specified type of Contact in the RP metadata.getContactSurName(String contactType) look for the <ContactPerson> and within that the SurName.protected ContactPersonTypeEnumerationgetContactType(String type) Parser for the contact type.protected StringLook for an <AttributeConsumeService> and if it's there look for an appropriate description.protected Stringlook at <UIInfo> if there and if so look for appropriate description.Shorthand method that returns a collapsed copy of the String values of a given mapped Entity Attribute in the metadata, or an empty collection.protected List<Locale.LanguageRange>Get the fallback languages.Get the <mdui:InformationURL>.private StringgetLocalizeString(Map<Locale, String> map, String type) Helper function for methods which need localized strings.getLogo()Get the Logo (or null).getLogo(int minWidth, int minHeight, int maxWidth, int maxHeight) Get the Logo (or null).Get the Logo (or null).protected StringLook for an <AttributeConsumeService> and if its there look for an appropriate name.protected StringIf the entityId can look like a host return that, otherwise the entityId in full.protected OrganizationUIInfoLook for the <OrganizationDisplayName>.Look for the <OrganizationName>.* Look for the <OrganizationURL>.Get the <mdui:PrivacyStatementURL>.protected ACSUIInfoGet theACSUIInfofor the request.protected EntityDescriptorGet theEntityDescriptor.protected SPSSODescriptorGet theSPSSODescriptor.protected IdPUIInfoGet the RPUIInfoassociated with the request.Get the service Description.Get the service name.private booleanDoes the logo fit the supplied parameters?private StringCheck to see whether a supplied URL is acceptable, returning the default if it isn't.protected StringpoliceURLLogo(String url) Police a url found for a logo.protected StringpoliceURLNonLogo(String url) Police a url found for non logo data.Set the browser languages.setFallbackLanguages(List<String> languages) Set the fallback languages.Set the Servlet Request.Set theACSUIInfofor the request.Set theEntityDescriptor.Set theSPSSODescriptor.setRPUInfo(UIInfo what) Set the RPIdPUIInfoassociated with the request.Methods inherited from class org.opensaml.messaging.context.BaseContext
addSubcontext, addSubcontext, clearSubcontexts, containsSubcontext, createSubcontext, ensureSubcontext, ensureSubcontext, getParent, getSubcontext, getSubcontext, getSubcontext, getSubcontext, iterator, removeFromParent, removeSubcontext, removeSubcontext, setParentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logThe log. -
rpEntityDescriptor
The appropriateEntityDescriptor. -
rpSPSSODescriptor
The appropriateSPSSODescriptor. -
rpACSUIinfo
The appropriateACSUIInfo. -
rpUIInfo
The appropriateIdPUIInfo. -
browserLanguages
The (statically defined) languages that this user wants to know about. -
fallbackLanguages
The languages that this the Operator want to fall back to. -
requestSupplier
A way of getting the current HTTP request, if available. Used to define dynamically selected languages.
-
-
Constructor Details
-
RelyingPartyUIContext
public RelyingPartyUIContext()Constructor.
-
-
Method Details
-
getRPEntityDescriptor
Get theEntityDescriptor.- Returns:
- Returns the entity.
-
setRPEntityDescriptor
Set theEntityDescriptor.- Parameters:
what- what to set- Returns:
- this context
-
getRPSPSSODescriptor
Get theSPSSODescriptor.- Returns:
- Returns the SPSSODescriptor.
-
setRPSPSSODescriptor
Set theSPSSODescriptor.- Parameters:
what- what to set- Returns:
- this context
-
getEntityAttributeStringValues
@Nonnull @NotLive @Unmodifiable public Collection<String> getEntityAttributeStringValues(@Nonnull @NotEmpty String id) Shorthand method that returns a collapsed copy of the String values of a given mapped Entity Attribute in the metadata, or an empty collection.- Parameters:
id- attribute ID- Returns:
- unmodifiable collection of string values
- Since:
- 4.0.0
-
getRPACSUInfo
Get theACSUIInfofor the request.- Returns:
- Returns the RP's
ACSUIInfo.
-
getRPUInfo
Get the RPUIInfoassociated with the request.- Returns:
- the value or null if there is none.
-
setRPUInfo
Set the RPIdPUIInfoassociated with the request. We normally expect to get this from the object metadata.- Parameters:
what- the value to set- Returns:
- this context
-
setRPAttributeConsumingService
@Nonnull public RelyingPartyUIContext setRPAttributeConsumingService(@Nullable AttributeConsumingService what) Set theACSUIInfofor the request. We normally expect to get this from the object metadata.- Parameters:
what- what to set- Returns:
- this context
-
setBrowserLanguageRanges
@Nonnull public RelyingPartyUIContext setBrowserLanguageRanges(@Nonnull List<Locale.LanguageRange> ranges) Set the browser languages.- Parameters:
ranges- the languages to set- Returns:
- this context
-
getBrowserLanguages
Get the browser languages. Interrogate the http Request (if available) otherwise got for the statically defined values.- Returns:
- the languages.
-
setFallbackLanguages
Set the fallback languages.- Parameters:
languages- the languages to set- Returns:
- this context
-
getFallbackLanguages
Get the fallback languages.- Returns:
- the languages.
-
policeURL
@Nullable private String policeURL(@Nullable String url, @Nonnull @NotEmpty List<String> acceptableSchemes) Check to see whether a supplied URL is acceptable, returning the default if it isn't.- Parameters:
url- the url to look atacceptableSchemes- the schemes to test against- Returns:
- the input or null as appropriate.
-
policeURLLogo
Police a url found for a logo.- Parameters:
url- the url to look at- Returns:
- the input or the default as appropriate
-
policeURLNonLogo
Police a url found for non logo data.- Parameters:
url- the url to look at- Returns:
- the input or the default as appropriate
-
getNameFromAttributeConsumingService
Look for an <AttributeConsumeService> and if its there look for an appropriate name.- Returns:
- null or an appropriate name
-
getNameFromEntityId
If the entityId can look like a host return that, otherwise the entityId in full.- Returns:
- either the host or the entityId.
-
getDescriptionFromUIInfo
look at <UIInfo> if there and if so look for appropriate description.- Returns:
- null or an appropriate description
-
getDescriptionFromAttributeConsumingService
Look for an <AttributeConsumeService> and if it's there look for an appropriate description.- Parameters:
lang- - which language to look up- Returns:
- null or an appropriate description
-
getOrganization
- Returns:
- the
Organizationfor the relying party.
-
getContactType
Parser for the contact type.- Parameters:
type- in value- Returns:
- the enumeration type. suitably defaulted.
-
getContactPerson
Lookup the specified type of Contact in the RP metadata.- Parameters:
contactType- what type to look up.- Returns:
- the
ContactPersonor null.
-
getServiceName
Get the service name.- Returns:
- the name or null if there wasn't one
-
getServiceDescription
Get the service Description.- Returns:
- the description or null if there wasn't one
-
getOrganizationDisplayName
Look for the <OrganizationDisplayName>.- Returns:
- An appropriate string or null
-
getOrganizationName
Look for the <OrganizationName>.- Returns:
- An appropriate string or null
-
getOrganizationURL
* Look for the <OrganizationURL>.- Returns:
- An appropriate string or the null
-
getContactSurName
look for the <ContactPerson> and within that the SurName.- Parameters:
contactType- the type of contact to look for- Returns:
- An appropriate string or null
-
getContactGivenName
look for the <ContactPerson> and within that the GivenName.- Parameters:
contactType- the type of contact to look for- Returns:
- An appropriate string or null
-
getContactEmail
look for the <ContactPerson> and within that the Email.- Parameters:
contactType- the type of contact to look for- Returns:
- An appropriate string or null
-
getLocalizeString
Helper function for methods which need localized strings.- Parameters:
map- the map to lookuptype- the name we are looking up (for logging)- Returns:
- the suitable value, or null
-
getInformationURL
Get the <mdui:InformationURL>.- Returns:
- the value or the default value
-
getPrivacyStatementURL
Get the <mdui:PrivacyStatementURL>.- Returns:
- the value or null
-
logoFits
private boolean logoFits(@Nonnull Logo logo, int minWidth, int minHeight, int maxWidth, int maxHeight) Does the logo fit the supplied parameters?- Parameters:
logo- the logominWidth- min WidthminHeight- min HeightmaxWidth- max WidthmaxHeight- max Height- Returns:
- whether it fits
-
getLogo
Get the Logo (or null). We apply the languages and the supplied lengths.- Parameters:
minWidth- the minimum width to allow.minHeight- the minimum height to allow.maxWidth- the maximum width to allow.maxHeight- the maximum height to allow.- Returns:
- an appropriate logo URL or null.
-
getLogo
@Nullable public String getLogo(String minWidth, String minHeight, String maxWidth, String maxHeight) Get the Logo (or null). We apply the languages and the supplied lengths.- Parameters:
minWidth- the minimum width to allow.minHeight- the minimum height to allow.maxWidth- the maximum width to allow.maxHeight- the maximum height to allow.- Returns:
- an appropriate logo URL or null.
-
getLogo
Get the Logo (or null). We apply the languages. Any size works.- Returns:
- an appropriate logo URL or null.
-