/** Constructor. */ public WSSecurityContext() { super(); tokens = new LazyList<>(); }
/** * Constructor. * * @param newSignableObject the SAMLObject this reference refers to */ public SAMLObjectContentReference(@Nonnull final SignableSAMLObject newSignableObject) { signableObject = newSignableObject; transforms = new LazyList<>(); // Set defaults digestAlgorithm = SignatureConstants.ALGO_ID_DIGEST_SHA256; transforms.add(SignatureConstants.TRANSFORM_ENVELOPED_SIGNATURE); transforms.add(SignatureConstants.TRANSFORM_C14N_EXCL_OMIT_COMMENTS); }
/** * Check for the existence of an index for the specified QName and create it * if it doesn't exist. * * @param index the index to check */ protected void checkAndCreateIndex(@Nonnull final QName index) { if (!objectIndex.containsKey(index)) { objectIndex.put(index, new LazyList<ElementType>()); } }
/** * Check for the existence of an index for the specified QName and create it * if it doesn't exist. * * @param index the index to check */ protected void checkAndCreateIndex(@Nonnull final QName index) { if (!objectIndex.containsKey(index)) { objectIndex.put(index, new LazyList<ElementType>()); } }
/** {@inheritDoc} */ public List<XMLObject> getOrderedChildren() { LazyList<XMLObject> children = new LazyList<>(); if (encryptedData != null) { children.add(encryptedData); } return Collections.unmodifiableList(children); }
/** Constructor. */ public ItemCollectionWithMetadata() { delegate = new LazyList<>(); metadata = new ClassToInstanceMultiMap<>(true); }
/** * Constructs an empty list with all added XMLObjects being assigned the given parent XMLObject. * * @param newParent the parent for all the added XMLObjects */ public XMLObjectChildrenList(@Nonnull final XMLObject newParent) { Constraint.isNotNull(newParent, "Parent cannot be null"); parent = newParent; elements = new LazyList<>(); }
/** * Constructs an empty list with all added XMLObjects being assigned the given parent XMLObject. * * @param newParent the parent for all the added XMLObjects */ public XMLObjectChildrenList(@Nonnull final XMLObject newParent) { Constraint.isNotNull(newParent, "Parent cannot be null"); parent = newParent; elements = new LazyList<>(); }
/** {@inheritDoc} */ @Override @Nonnull protected List<X509Certificate> getCertificates() { final List<X509Certificate> certs = new LazyList<>(); for (final String cert : certificates) { try { certs.add(X509Support.decodeCertificate(cert.trim())); } catch (final CertificateException e) { log.error("{}: Could not decode provided Certificate", getConfigDescription(), e); throw new FatalBeanException("Could not decode provided Certificate", e); } } return certs; }
/** * Pluck the languages from the browser. * * @return the two letter language */ @Nonnull @NonnullElements protected List<String> getBrowserLanguages() { final Enumeration<Locale> locales = getHttpServletRequest().getLocales(); final List<String> languages = new LazyList<>(); while (locales.hasMoreElements()) { final Locale locale = locales.nextElement(); if (null != locale.getLanguage()) { languages.add(locale.getLanguage()); } } return languages; }
/** * Pluck the languages from the browser. * * @return the two letter language */ @Nonnull @NonnullElements private List<String> getBrowserLanguages() { final Enumeration<Locale> locales = getHttpServletRequest().getLocales(); final List<String> languages = new LazyList<>(); while (locales.hasMoreElements()) { final Locale locale = locales.nextElement(); if (null != locale.getLanguage()) { languages.add(locale.getLanguage()); } } return languages; }
/** {@inheritDoc} */ @Override @Nullable protected List<X509CRL> getCRLs() { if (null == crls) { return null; } final List<X509CRL> result = new LazyList<>(); for (final String crl : crls) { try { result.add(X509Support.decodeCRL(crl)); } catch (final CRLException | CertificateException e) { log.error("{}: Could not decode provided CRL", getConfigDescription(), e); throw new FatalBeanException("Could not decode provided CRL", e); } } return result; } }
/** * Constructs a list containing the elements in the specified collection, in the order they are returned by the * collection's iterator, with each added XMLObject assigned the given parent XMLObject. * * <p>An IllegalArgumentException is thrown if any of the XMLObjects in the given collection already have a parent * other than the given parent * * @param newParent the parent for all the added XMLObjects * @param newElements the elements to be added */ public XMLObjectChildrenList(@Nonnull final XMLObject newParent, @Nonnull final Collection<ElementType> newElements) { Constraint.isNotNull(newParent, "Parent cannot be null"); Constraint.isNotNull(newElements, "Initial collection cannot be null"); parent = newParent; elements = new LazyList<>(); // This does call our add, which handles the null case properly, but // I didn't want to depend on that implementation. Keeping the fail silently // behavior means not using an Immutable collection copy. addAll(Collections2.filter(newElements, Predicates.notNull())); }
/** * Gets the {@link ItemMetadata} to be added to each {@link Item}'s item metadata. * * @param metadata the {@link ItemMetadata} to be added to each {@link Item}'s item metadata */ public void setAdditionalItemMetadata(@Nonnull final Collection<ItemMetadata> metadata) { ComponentSupport.ifDestroyedThrowDestroyedComponentException(this); ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); Constraint.isNotNull(metadata, "additional metadata collection must not be null"); additionalItemMetadata = new LazyList<>(); CollectionSupport.addIf(additionalItemMetadata, metadata, Predicates.notNull()); }
/** {@inheritDoc} */ @Override @Nonnull protected List<X509Certificate> getCertificates() { if (certificateResources == null) { return Collections.emptyList(); } final List<X509Certificate> certificates = new LazyList<>(); for (final Resource r : certificateResources) { try(InputStream is = r.getInputStream()) { certificates.addAll(X509Support.decodeCertificates(is)); } catch (final CertificateException | IOException e) { log.error("{}: could not decode CertificateFile at {}: {}", getConfigDescription(), r.getDescription(), e); throw new FatalBeanException("Could not decode provided CertificateFile: " + r.getDescription(), e); } } return certificates; }
/** * Gets the list of attributes, identified by IDs, that should be resolved. If the * {@link AttributeResolutionContext#getRequestedIdPAttributeNames()} is not empty then those attributes are the * ones to be resolved, otherwise all registered attribute definitions are to be resolved. * * @param resolutionContext current resolution context * * @return list of attributes, identified by IDs, that should be resolved */ @Nonnull @NonnullElements protected Collection<String> getToBeResolvedAttributeIds( @Nonnull final AttributeResolutionContext resolutionContext) { Constraint.isNotNull(resolutionContext, "Attribute resolution context cannot be null"); // if no attributes requested, then resolve everything if (resolutionContext.getRequestedIdPAttributeNames().isEmpty()) { final Collection<String> attributeIds = new LazyList<>(); attributeIds.addAll(attributeDefinitions.keySet()); return attributeIds; } else { return resolutionContext.getRequestedIdPAttributeNames(); } }
/** {@inheritDoc} */ @Override public void clear() { // Create a copy of the current list to avoid a potential concurrent modification error. LazyList<ElementType> copy = new LazyList<>(); copy.addAll(indexList); backingList.removeAll(copy); indexList = backingList.get(index); }
/** {@inheritDoc} */ @Override public void clear() { // Create a copy of the current list to avoid a potential concurrent modification error. LazyList<ElementType> copy = new LazyList<>(); copy.addAll(indexList); backingList.removeAll(copy); indexList = backingList.get(index); }
/** {@inheritDoc} */ @Override @Nullable protected List<X509CRL> getCRLs() { if (null == crlResources) { return null; } final List<X509CRL> crls = new LazyList<>(); for (final Resource crl : crlResources) { try (InputStream is = crl.getInputStream()) { crls.addAll(X509Support.decodeCRLs(is)); } catch (final CRLException | IOException e) { log.error("{}: Could not decode CRL file: {}", getConfigDescription(), crl.getDescription(), e); throw new FatalBeanException("Could not decode provided CRL file " + crl.getDescription(), e); } } return crls; } }
/** * Constructor. * * @param namespaceURI the namespace the element is in * @param elementLocalName the local name of the XML element this Object represents * @param namespacePrefix the prefix for the given namespace */ protected RoleDescriptorImpl(String namespaceURI, String elementLocalName, String namespacePrefix) { super(namespaceURI, elementLocalName, namespacePrefix); unknownAttributes = new AttributeMap(this); supportedProtocols = new LazyList<>(); contactPersons = new XMLObjectChildrenList<>(this); keyDescriptors = new XMLObjectChildrenList<>(this); }