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>`

public final class RelyingPartyUIContext extends 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

Fields
Modifier and Type
Field
Description
`private List<Locale.LanguageRange>`
`browserLanguages`
The (statically defined) languages that this user wants to know about.
`private List<Locale.LanguageRange>`
`fallbackLanguages`
The languages that this the Operator want to fall back to.
`private final org.slf4j.Logger`
`log`
The log.
`private NonnullSupplier<HttpServletRequest>`
`requestSupplier`
A way of getting the current HTTP request, if available.
`private ACSUIInfo`
`rpACSUIinfo`
The appropriate `ACSUIInfo`.
`private EntityDescriptor`
`rpEntityDescriptor`
The appropriate `EntityDescriptor`.
`private SPSSODescriptor`
`rpSPSSODescriptor`
The appropriate `SPSSODescriptor`.
`private IdPUIInfo`
`rpUIInfo`
The appropriate `IdPUIInfo`.

## Constructor Summary

Constructors
Constructor
Description
`RelyingPartyUIContext()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected List<Locale.LanguageRange>`
`getBrowserLanguages()`
Get the browser languages.
`String`
`getContactEmail(String contactType)`
look for the <ContactPerson> and within that the Email.
`String`
`getContactGivenName(String contactType)`
look for the <ContactPerson> and within that the GivenName.
`ContactPerson`
`getContactPerson(ContactPersonTypeEnumeration contactType)`
Lookup the specified type of Contact in the RP metadata.
`String`
`getContactSurName(String contactType)`
look for the <ContactPerson> and within that the SurName.
`protected ContactPersonTypeEnumeration`
`getContactType(String type)`
Parser for the contact type.
`protected String`
`getDescriptionFromAttributeConsumingService(String lang)`
Look for an <AttributeConsumeService> and if it's there look for an appropriate description.
`protected String`
`getDescriptionFromUIInfo()`
look at <UIInfo> if there and if so look for appropriate description.
`Collection<String>`
`getEntityAttributeStringValues(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.
`protected List<Locale.LanguageRange>`
`getFallbackLanguages()`
Get the fallback languages.
`String`
`getInformationURL()`
Get the <mdui:InformationURL>.
`private String`
`getLocalizeString(Map<Locale,String> map, String type)`
Helper function for methods which need localized strings.
`String`
`getLogo()`
Get the Logo (or null).
`String`
`getLogo(int minWidth, int minHeight, int maxWidth, int maxHeight)`
Get the Logo (or null).
`String`
`getLogo(String minWidth, String minHeight, String maxWidth, String maxHeight)`
Get the Logo (or null).
`protected String`
`getNameFromAttributeConsumingService()`
Look for an <AttributeConsumeService> and if its there look for an appropriate name.
`protected String`
`getNameFromEntityId()`
If the entityId can look like a host return that, otherwise the entityId in full.
`protected OrganizationUIInfo`
`getOrganization()`
Get the `Organization` from the `SPSSODescriptor`, failing that the `EntityDescriptor`.
`String`
`getOrganizationDisplayName()`
Look for the <OrganizationDisplayName>.
`String`
`getOrganizationName()`
Look for the <OrganizationName>.
`String`
`getOrganizationURL()`
* Look for the <OrganizationURL>.
`String`
`getPrivacyStatementURL()`
Get the <mdui:PrivacyStatementURL>.
`protected ACSUIInfo`
`getRPACSUInfo()`
Get the `ACSUIInfo` for the request.
`protected EntityDescriptor`
`getRPEntityDescriptor()`
Get the `EntityDescriptor`.
`protected SPSSODescriptor`
`getRPSPSSODescriptor()`
Get the `SPSSODescriptor`.
`protected IdPUIInfo`
`getRPUInfo()`
Get the RP `UIInfo` associated with the request.
`String`
`getServiceDescription()`
Get the service Description.
`String`
`getServiceName()`
Get the service name.
`private boolean`
`logoFits(Logo logo, int minWidth, int minHeight, int maxWidth, int maxHeight)`
Does the logo fit the supplied parameters?
`private String`
`policeURL(String url, List<String> acceptableSchemes)`
Check to see whether a supplied URL is acceptable, returning the default if it isn't.
`protected String`
`policeURLLogo(String url)`
Police a url found for a logo.
`protected String`
`policeURLNonLogo(String url)`
Police a url found for non logo data.
`RelyingPartyUIContext`
`setBrowserLanguageRanges(List<Locale.LanguageRange> ranges)`
Set the browser languages.
`RelyingPartyUIContext`
`setFallbackLanguages(List<String> languages)`
Set the fallback languages.
`RelyingPartyUIContext`
`setRequestSupplier(NonnullSupplier<HttpServletRequest> what)`
Set the Servlet Request.
`RelyingPartyUIContext`
`setRPAttributeConsumingService(AttributeConsumingService what)`
Set the `ACSUIInfo` for the request.
`RelyingPartyUIContext`
`setRPEntityDescriptor(EntityDescriptor what)`
Set the `EntityDescriptor`.
`RelyingPartyUIContext`
`setRPSPSSODescriptor(SPSSODescriptor what)`
Set the `SPSSODescriptor`.
`RelyingPartyUIContext`
`setRPUInfo(UIInfo what)`
Set the RP `IdPUIInfo` associated 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, 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

### log

@Nonnull private final org.slf4j.Logger log
The log.

### rpEntityDescriptor

@Nullable private EntityDescriptor rpEntityDescriptor
The appropriate `EntityDescriptor`.

### rpSPSSODescriptor

@Nullable private SPSSODescriptor rpSPSSODescriptor
The appropriate `SPSSODescriptor`.

### rpACSUIinfo

@Nullable private ACSUIInfo rpACSUIinfo
The appropriate `ACSUIInfo`.

### rpUIInfo

@Nullable private IdPUIInfo rpUIInfo
The appropriate `IdPUIInfo`.

### browserLanguages

@Nonnull private List<Locale.LanguageRange> browserLanguages
The (statically defined) languages that this user wants to know about.

### fallbackLanguages

@Nonnull private List<Locale.LanguageRange> fallbackLanguages
The languages that this the Operator want to fall back to.

### requestSupplier

@Nullable private NonnullSupplier<HttpServletRequest> 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

@Nullable protected EntityDescriptor getRPEntityDescriptor()
Get the `EntityDescriptor`.

Returns:
  Returns the entity.

### setRPEntityDescriptor

@Nonnull public RelyingPartyUIContext setRPEntityDescriptor(@Nullable EntityDescriptor what)
Set the `EntityDescriptor`.

Parameters:
  `what` - what to set
Returns:
  this context

### getRPSPSSODescriptor

@Nullable protected SPSSODescriptor getRPSPSSODescriptor()
Get the `SPSSODescriptor`.

Returns:
  Returns the SPSSODescriptor.

### setRPSPSSODescriptor

@Nonnull public RelyingPartyUIContext setRPSPSSODescriptor(@Nullable SPSSODescriptor what)
Set the `SPSSODescriptor`.

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

@Nullable protected ACSUIInfo getRPACSUInfo()
Get the `ACSUIInfo` for the request.

Returns:
  Returns the RP's `ACSUIInfo`.

### getRPUInfo

@Nullable protected IdPUIInfo getRPUInfo()
Get the RP `UIInfo` associated with the request.

Returns:
  the value or null if there is none.

### setRPUInfo

@Nonnull public RelyingPartyUIContext setRPUInfo(@Nullable UIInfo what)
Set the RP `IdPUIInfo` associated 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 the `ACSUIInfo` for the request. We normally expect to get this from the object metadata.

Parameters:
  `what` - what to set
Returns:
  this context

### setRequestSupplier

public RelyingPartyUIContext setRequestSupplier(@Nonnull NonnullSupplier<HttpServletRequest> what)
Set the Servlet Request.

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

@Nonnull protected List<Locale.LanguageRange> getBrowserLanguages()
Get the browser languages. Interrogate the http Request (if available) otherwise got for the statically defined values.

Returns:
  the languages.

### setFallbackLanguages

@Nonnull public RelyingPartyUIContext setFallbackLanguages(@Nullable List<String> languages)
Set the fallback languages.

Parameters:
  `languages` - the languages to set
Returns:
  this context

### getFallbackLanguages

@Nonnull protected List<Locale.LanguageRange> 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 at
  `acceptableSchemes` - the schemes to test against
Returns:
  the input or null as appropriate.

### policeURLLogo

@Nullable protected String policeURLLogo(@Nullable String url)
Police a url found for a logo.

Parameters:
  `url` - the url to look at
Returns:
  the input or the default as appropriate

### policeURLNonLogo

@Nullable protected String policeURLNonLogo(@Nullable String url)
Police a url found for non logo data.

Parameters:
  `url` - the url to look at
Returns:
  the input or the default as appropriate

### getNameFromAttributeConsumingService

@Nullable protected String getNameFromAttributeConsumingService()
Look for an <AttributeConsumeService> and if its there look for an appropriate name.

Returns:
  null or an appropriate name

### getNameFromEntityId

@Nullable protected String getNameFromEntityId()
If the entityId can look like a host return that, otherwise the entityId in full.

Returns:
  either the host or the entityId.

### getDescriptionFromUIInfo

@Nullable protected String getDescriptionFromUIInfo()
look at <UIInfo> if there and if so look for appropriate description.

Returns:
  null or an appropriate description

### getDescriptionFromAttributeConsumingService

@Nullable protected String getDescriptionFromAttributeConsumingService(String lang)
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

@Nullable protected OrganizationUIInfo getOrganization()
Get the `Organization` from the `SPSSODescriptor`, failing that the `EntityDescriptor`.

Returns:
  the `Organization` for the relying party.

### getContactType

protected ContactPersonTypeEnumeration getContactType(@Nullable String type)
Parser for the contact type.

Parameters:
  `type` - in value
Returns:
  the enumeration type. suitably defaulted.

### getContactPerson

@Nullable public ContactPerson getContactPerson(ContactPersonTypeEnumeration contactType)
Lookup the specified type of Contact in the RP metadata.

Parameters:
  `contactType` - what type to look up.
Returns:
  the `ContactPerson` or null.

### getServiceName

@Nullable public String getServiceName()
Get the service name.

Returns:
  the name or null if there wasn't one

### getServiceDescription

@Nullable public String getServiceDescription()
Get the service Description.

Returns:
  the description or null if there wasn't one

### getOrganizationDisplayName

@Nullable public String getOrganizationDisplayName()
Look for the <OrganizationDisplayName>.

Returns:
  An appropriate string or null

### getOrganizationName

@Nullable public String getOrganizationName()
Look for the <OrganizationName>.

Returns:
  An appropriate string or null

### getOrganizationURL

public String getOrganizationURL()
* Look for the <OrganizationURL>.

Returns:
  An appropriate string or the null

### getContactSurName

@Nullable public String getContactSurName(@Nullable String contactType)
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

@Nullable public String getContactGivenName(@Nullable String contactType)
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

@Nullable public String getContactEmail(@Nullable String contactType)
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

@Nullable private String getLocalizeString(@Nonnull Map<Locale,String> map, @Nonnull String type)
Helper function for methods which need localized strings.

Parameters:
  `map` - the map to lookup
  `type` - the name we are looking up (for logging)
Returns:
  the suitable value, or null

### getInformationURL

@Nullable public String getInformationURL()
Get the <mdui:InformationURL>.

Returns:
  the value or the default value

### getPrivacyStatementURL

@Nullable public String 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 logo
  `minWidth` - min Width
  `minHeight` - min Height
  `maxWidth` - max Width
  `maxHeight` - max Height
Returns:
  whether it fits

### getLogo

@Nullable public String getLogo(int minWidth, int minHeight, int maxWidth, int 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

@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

@Nullable public String getLogo()
Get the Logo (or null). We apply the languages. Any size works.

Returns:
  an appropriate logo URL or null.