/** * @see {@link ParserNamespaceSupport#parse(XMLEventReader)} */ public Object parse(XMLEventReader xmlEventReader) throws ParsingException { OnBehalfOfType onBehalfType = new OnBehalfOfType(); StartElement startElement = StaxParserUtil.peekNextStartElement(xmlEventReader); String tag = StaxParserUtil.getStartElementName(startElement); if (tag.equals(WSTrustConstants.WSSE.USERNAME_TOKEN)) { WSSecurityParser wsseParser = new WSSecurityParser(); UsernameTokenType userNameToken = (UsernameTokenType) wsseParser.parse(xmlEventReader); onBehalfType.add(userNameToken); } else throw new RuntimeException(ErrorCodes.UNKNOWN_TAG + tag); return onBehalfType; }
/** * @see {@link ParserNamespaceSupport#parse(XMLEventReader)} */ public Object parse(XMLEventReader xmlEventReader) throws ParsingException { OnBehalfOfType onBehalfType = new OnBehalfOfType(); StartElement startElement = StaxParserUtil.peekNextStartElement(xmlEventReader); String tag = StaxParserUtil.getStartElementName(startElement); if (tag.equals(WSTrustConstants.WSSE.USERNAME_TOKEN)) { WSSecurityParser wsseParser = new WSSecurityParser(); UsernameTokenType userNameToken = (UsernameTokenType) wsseParser.parse(xmlEventReader); onBehalfType.add(userNameToken); } else throw new RuntimeException(ErrorCodes.UNKNOWN_TAG + tag); return onBehalfType; }
/** * Write an {@code OnBehalfOfType} to stream * @param onBehalfOf * @param out * @throws ProcessingException */ private void writeOnBehalfOfType(OnBehalfOfType onBehalfOf) throws ProcessingException { StaxUtil.writeStartElement(writer, PREFIX, WSTrustConstants.ON_BEHALF_OF, BASE_NAMESPACE); UsernameTokenType usernameToken = (UsernameTokenType) onBehalfOf.getAny().get(0); WSSecurityWriter wsseWriter = new WSSecurityWriter(this.writer); wsseWriter.write(usernameToken); StaxUtil.writeEndElement(writer); }
/** * @see {@link ParserNamespaceSupport#parse(XMLEventReader)} */ public Object parse(XMLEventReader xmlEventReader) throws ParsingException { OnBehalfOfType onBehalfType = new OnBehalfOfType(); StartElement startElement = StaxParserUtil.peekNextStartElement(xmlEventReader); String tag = StaxParserUtil.getStartElementName(startElement); if (tag.equals(WSTrustConstants.WSSE.USERNAME_TOKEN)) { WSSecurityParser wsseParser = new WSSecurityParser(); UsernameTokenType userNameToken = (UsernameTokenType) wsseParser.parse(xmlEventReader); onBehalfType.add(userNameToken); } else throw logger.parserUnknownTag(tag, startElement.getLocation()); return onBehalfType; }
/** * <p> * Creates a {@code OnBehalfOfType} instance that contains a {@code UsernameTokenType}. * </p> * * @param username a {@code String} that represents the username of the {@code UsernameTokenType}. * @param id an optional {@code String} that uniquely identifies the {@code UsernameTokenType}. * * @return the constructed {@code OnBehalfOfType} instance. */ public static OnBehalfOfType createOnBehalfOfWithUsername(String username, String id) { AttributedString attrString = new AttributedString(); attrString.setValue(username); UsernameTokenType usernameToken = new UsernameTokenType(); usernameToken.setId(id); usernameToken.setUsername(attrString); // create the OnBehalfOfType and set the UsernameTokenType. OnBehalfOfType onBehalfOf = new OnBehalfOfType(); onBehalfOf.add(usernameToken); return onBehalfOf; }
/** * Write an {@code OnBehalfOfType} to stream * * @param onBehalfOf * @param out * @throws ProcessingException */ private void writeOnBehalfOfType(OnBehalfOfType onBehalfOf) throws ProcessingException { StaxUtil.writeStartElement(writer, PREFIX, WSTrustConstants.ON_BEHALF_OF, BASE_NAMESPACE); UsernameTokenType usernameToken = (UsernameTokenType) onBehalfOf.getAny().get(0); WSSecurityWriter wsseWriter = new WSSecurityWriter(this.writer); wsseWriter.write(usernameToken); StaxUtil.writeEndElement(writer); }
/** * @see {@link ParserNamespaceSupport#parse(XMLEventReader)} */ public Object parse(XMLEventReader xmlEventReader) throws ParsingException { OnBehalfOfType onBehalfType = new OnBehalfOfType(); StartElement startElement = StaxParserUtil.peekNextStartElement(xmlEventReader); String tag = StaxParserUtil.getStartElementName(startElement); if (tag.equals(WSTrustConstants.WSSE.USERNAME_TOKEN)) { WSSecurityParser wsseParser = new WSSecurityParser(); UsernameTokenType userNameToken = (UsernameTokenType) wsseParser.parse(xmlEventReader); onBehalfType.add(userNameToken); } else throw logger.parserUnknownTag(tag, startElement.getLocation()); return onBehalfType; }
/** * @see {@link ParserNamespaceSupport#parse(XMLEventReader)} */ public Object parse(XMLEventReader xmlEventReader) throws ParsingException { OnBehalfOfType onBehalfType = new OnBehalfOfType(); StartElement startElement = StaxParserUtil.peekNextStartElement(xmlEventReader); String tag = StaxParserUtil.getStartElementName(startElement); if (tag.equals(WSTrustConstants.WSSE.USERNAME_TOKEN)) { WSSecurityParser wsseParser = new WSSecurityParser(); UsernameTokenType userNameToken = (UsernameTokenType) wsseParser.parse(xmlEventReader); onBehalfType.add(userNameToken); } else throw logger.parserUnknownTag(tag, startElement.getLocation()); return onBehalfType; }
/** * Write an {@code OnBehalfOfType} to stream * * @param onBehalfOf * @param out * * @throws ProcessingException */ private void writeOnBehalfOfType(OnBehalfOfType onBehalfOf) throws ProcessingException { StaxUtil.writeStartElement(writer, PREFIX, WSTrustConstants.ON_BEHALF_OF, BASE_NAMESPACE); UsernameTokenType usernameToken = (UsernameTokenType) onBehalfOf.getAny().get(0); WSSecurityWriter wsseWriter = new WSSecurityWriter(this.writer); wsseWriter.write(usernameToken); StaxUtil.writeEndElement(writer); }
/** * <p> * Creates a {@code OnBehalfOfType} instance that contains a {@code UsernameTokenType}. * </p> * * @param username a {@code String} that represents the username of the {@code UsernameTokenType}. * @param id an optional {@code String} that uniquely identifies the {@code UsernameTokenType}. * * @return the constructed {@code OnBehalfOfType} instance. */ public static OnBehalfOfType createOnBehalfOfWithUsername(String username, String id) { AttributedString attrString = new AttributedString(); attrString.setValue(username); UsernameTokenType usernameToken = new UsernameTokenType(); usernameToken.setId(id); usernameToken.setUsername(attrString); // create the OnBehalfOfType and set the UsernameTokenType. OnBehalfOfType onBehalfOf = new OnBehalfOfType(); onBehalfOf.add(usernameToken); return onBehalfOf; }
/** * <p> * Creates a {@code OnBehalfOfType} instance that contains a {@code UsernameTokenType}. * </p> * * @param username a {@code String} that represents the username of the {@code UsernameTokenType}. * @param id an optional {@code String} that uniquely identifies the {@code UsernameTokenType}. * @return the constructed {@code OnBehalfOfType} instance. */ public static OnBehalfOfType createOnBehalfOfWithUsername(String username, String id) { AttributedString attrString = new AttributedString(); attrString.setValue(username); UsernameTokenType usernameToken = new UsernameTokenType(); usernameToken.setId(id); usernameToken.setUsername(attrString); // create the OnBehalfOfType and set the UsernameTokenType. OnBehalfOfType onBehalfOf = new OnBehalfOfType(); onBehalfOf.add(usernameToken); return onBehalfOf; }
/** * Write an {@code OnBehalfOfType} to stream * * @param onBehalfOf * @param out * * @throws ProcessingException */ private void writeOnBehalfOfType(OnBehalfOfType onBehalfOf) throws ProcessingException { StaxUtil.writeStartElement(writer, PREFIX, WSTrustConstants.ON_BEHALF_OF, BASE_NAMESPACE); UsernameTokenType usernameToken = (UsernameTokenType) onBehalfOf.getAny().get(0); WSSecurityWriter wsseWriter = new WSSecurityWriter(this.writer); wsseWriter.write(usernameToken); StaxUtil.writeEndElement(writer); }
/** * <p> * Creates a {@code OnBehalfOfType} instance that contains a {@code UsernameTokenType}. * </p> * * @param username a {@code String} that represents the username of the {@code UsernameTokenType}. * @param id an optional {@code String} that uniquely identifies the {@code UsernameTokenType}. * @return the constructed {@code OnBehalfOfType} instance. */ public static OnBehalfOfType createOnBehalfOfWithUsername(String username, String id) { AttributedString attrString = new AttributedString(); attrString.setValue(username); UsernameTokenType usernameToken = new UsernameTokenType(); usernameToken.setId(id); usernameToken.setUsername(attrString); // create the OnBehalfOfType and set the UsernameTokenType. OnBehalfOfType onBehalfOf = new OnBehalfOfType(); onBehalfOf.add(usernameToken); return onBehalfOf; }
/** * Write an {@code OnBehalfOfType} to stream * @param onBehalfOf * @param out * @throws ProcessingException */ private void writeOnBehalfOfType(OnBehalfOfType onBehalfOf) throws ProcessingException { StaxUtil.writeStartElement(writer, PREFIX, WSTrustConstants.ON_BEHALF_OF, BASE_NAMESPACE); UsernameTokenType usernameToken = (UsernameTokenType) onBehalfOf.getAny().get(0); WSSecurityWriter wsseWriter = new WSSecurityWriter(this.writer); wsseWriter.write(usernameToken); StaxUtil.writeEndElement(writer); }
/** * <p> * Creates a {@code OnBehalfOfType} instance that contains a {@code UsernameTokenType}. * </p> * * @param username a {@code String} that represents the username of the {@code UsernameTokenType}. * @param id an optional {@code String} that uniquely identifies the {@code UsernameTokenType}. * @return the constructed {@code OnBehalfOfType} instance. */ public static OnBehalfOfType createOnBehalfOfWithUsername(String username, String id) { AttributedString attrString = new AttributedString(); attrString.setValue(username); UsernameTokenType usernameToken = new UsernameTokenType(); usernameToken.setId(id); usernameToken.setUsername(attrString); // create the OnBehalfOfType and set the UsernameTokenType. OnBehalfOfType onBehalfOf = new OnBehalfOfType(); onBehalfOf.add(usernameToken); return onBehalfOf; }