com.sun.xml.wss.saml.assertion.saml11.jaxb20.NameIdentifier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of webservices-osgi Show documentation
Show all versions of webservices-osgi Show documentation
Metro Web Services Runtime OSGi Bundle
/*
* Copyright (c) 2010, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* $Id: NameIdentifier.java,v 1.2 2010-10-21 15:38:00 snajper Exp $
*/
package com.sun.xml.wss.saml.assertion.saml11.jaxb20;
import com.sun.xml.wss.saml.SAMLException;
import com.sun.xml.wss.logging.LogDomainConstants;
import com.sun.xml.wss.saml.internal.saml11.jaxb20.NameIdentifierType;
import com.sun.xml.wss.saml.util.SAMLJAXBUtil;
import java.util.logging.Logger;
import jakarta.xml.bind.JAXBContext;
/**
*The NameIdentifier element specifies a Subject
by a combination
* of a name and a security domain governing the name of the Subject
.
*/
public class NameIdentifier extends NameIdentifierType
implements com.sun.xml.wss.saml.NameIdentifier {
protected static final Logger log = Logger.getLogger(
LogDomainConstants.WSS_API_DOMAIN,
LogDomainConstants.WSS_API_DOMAIN_BUNDLE);
/**
* Constructs a NameIdentifer
element from an existing XML
* block.
*
* @param element A org.w3c.dom.Element
* representing DOM tree for NameIdentifier
object
* @exception SAMLException if it could not process the
* org.w3c.dom.Element
properly, implying that there
* is an error in the sender or in the element definition.
*/
public static NameIdentifierType fromElement(org.w3c.dom.Element element)
throws SAMLException {
try {
JAXBContext jc = SAMLJAXBUtil.getJAXBContext();
jakarta.xml.bind.Unmarshaller u = jc.createUnmarshaller();
return (NameIdentifierType)u.unmarshal(element);
} catch ( Exception ex) {
throw new SAMLException(ex.getMessage());
}
}
/**
* Constructs a NameQualifier
instance.
*
* @param name The string representing the name of the Subject
* @param nameQualifier The security or administrative domain that qualifies
* the name of the Subject
. This is optional could be
* null or "".
* @param format The syntax used to describe the name of the
* Subject
. This optional, could be null or "".
*/
public NameIdentifier(String name, String nameQualifier, String format)
{
if ( name != null)
setValue(name);
if ( nameQualifier != null)
setNameQualifier(nameQualifier);
if ( format != null)
setFormat(format);
}
public NameIdentifier(NameIdentifierType nameIdType){
setValue(nameIdType.getValue());
setNameQualifier(nameIdType.getNameQualifier());
setFormat(nameIdType.getFormat());
}
@Override
public String getValue() {
return super.getValue();
}
@Override
public String getFormat() {
return super.getFormat();
}
@Override
public String getNameQualifier() {
return super.getNameQualifier();
}
}