- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.n52.security.common.xml.XMLPath.text()
方法的一些代码示例,展示了XMLPath.text()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLPath.text()
方法的具体详情如下:
包路径:org.n52.security.common.xml.XMLPath
类名称:XMLPath
方法名:text
[英]Method text, expects a xpath query resulting in a string.
[中]方法文本,需要xpath查询生成字符串。
代码示例来源:origin: org.n52.metadata/smarteditor-api
private void buildExtentTemplate(Document document, Map<String, String> hashMap, XMLPathCtx xmlPathCtx) {
hashMap.put("west", xmlPathCtx.findIn(document).text("//gmd:westBoundLongitude/*/text()").get());
hashMap.put("east", xmlPathCtx.findIn(document).text("//gmd:eastBoundLongitude/*/text()").get());
hashMap.put("north", xmlPathCtx.findIn(document).text("//gmd:northBoundLatitude/*/text()").get());
hashMap.put("south", xmlPathCtx.findIn(document).text("//gmd:southBoundLatitude/*/text()").get());
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
private void buildPartyTemplate(Document document, Map<String, String> hashMap, XMLPathCtx xmlPathCtx) {
hashMap.put("IndividualName", xmlPathCtx.findIn(document).text("//gmd:individualName/*/text()").get());
hashMap.put("PositionName", xmlPathCtx.findIn(document).text("//gmd:positionName/*/text()").get());
hashMap.put("OrganisationName", xmlPathCtx.findIn(document).text("//gmd:organisationName/*/text()").get());
hashMap.put("Voice", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:phone/*/gmd:voice/*/text()").get());
hashMap.put("Fax", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:phone/*/gmd:facsimile/*/text()").get());
hashMap.put("DeliveryPoint", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:address/*/gmd:deliveryPoint/*/text()").get());
hashMap.put("City", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:address/*/gmd:city/*/text()").get());
hashMap.put("AdministrativeArea", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:address/*/gmd:administrativeArea/*/text()").get());
hashMap.put("PostalCode", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:address/*/gmd:postalCode/*/text()").get());
hashMap.put("Country", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:address/*/gmd:country/*/text()").get());
hashMap.put("MailAddress", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:address/*/gmd:electronicMailAddress/*/text()").get());
hashMap.put("Role", xmlPathCtx.findIn(document).text("//gmd:role/*/@codeListValue").get());
hashMap.put("Url", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:onlineResource/*/gmd:linkage/gmd:URL").get());
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
/**
* Load a builder class defined in '/catalog_api_factory.xml'
*
* @param pType xml or kvp is standard, any other type might be given also
* @param pName Name of the REquest (GetRecords, GetCapabilities, ect)
* @return Class or null, if not loaded
*/
protected Class loadClass(String pType, String pName) {
String lExpression = "//api:BuilderFactory/api:Group[@type='" + pType + "']/api:Builder[@name='" + pName + "']/api:class";
LOG.debug("Evaluating expression: {} ", lExpression);
String className = xmlPathCtx.findIn(mRoot).text(lExpression).get();
if (className == null) {
LOG.warn(lExpression + " could not be evaluated. Result is null.");
return null;
}
try {
return Class.forName(className);
} catch (ClassNotFoundException e) {
LOG.error(e.getMessage());
return null;
}
}
代码示例来源:origin: org.n52.security/52n-security-decision-xacml
private void debugPDPResponse(Element response) {
StringBuilder text = new StringBuilder();
String resourceId = XMLPathCtx.createNew().findIn(response).text("//*[local-name() = 'Result']/@ResourceId").get();
String decision = XMLPathCtx.createNew().findIn(response).text("//*[local-name() = 'Result']/*[local-name() = 'Decision']/text()").get();
text.append("Resource: \t").append(resourceId ).append("\n");
text.append("Decision: \t").append(decision).append("\n");
NodeList obligationNodes = XMLPathCtx.createNew().findIn(response).all("//*[local-name() = 'Obligation']").get();
for (int i = 0; i < obligationNodes.getLength(); i++) {
Element obligationElem = (Element) obligationNodes.item(i);
String oblId = obligationElem.getAttribute("ObligationId");
String fulfillOn = obligationElem.getAttribute("FulfillOn");
text.append("Obligation: \t").append(oblId ).append("(fulfillOn:").append(fulfillOn).append(")\n");
appendAttributeAssignments(text, XMLPathCtx.createNew().findIn(obligationElem).all(".//*[local-name()='AttributeAssignment']").get());
}
LOG.debug("PDP response\n" + text);
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
String fileIdentifier = xmlPathContextFactory.createContext().findIn(document).text("//gmd:fileIdentifier/gco:CharacterString/text()").get();
代码示例来源:origin: org.n52.metadata/smarteditor-api
public String getTemplateFor(Document document) {
Node rootNode = context.findIn(document).node("/*[1]").get();
String serviceType = getServiceTypeFrom(rootNode);
String version = context.findIn(rootNode).text("@version").get();
return version.equals("") ? templateMap.get(serviceType) : templateMap.get(serviceType + "_" + version);
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
for (Document record : records) {
Map<String, Object> innerMap = new HashMap<>();
String fileIdentifier = context.findIn(record).text("//gmd:fileIdentifier[1]/*/text()").get();
String title = context.findIn(record).text("//gmd:identificationInfo[1]/*/gmd:citation/*/gmd:title/*/text()").get();
String lResourceType = context.findIn(record).text("//gmd:hierarchyLevel[1]/*/@codeListValue").get();
innerMap.put("title", title);
innerMap.put("resourceType", lResourceType);
for (int i = 0; i < identifiers.getLength(); i++) {
Node node = identifiers.item(i);
String code = context.findIn(node).text("gmd:code/*/text()").get();
String codeSpace = context.findIn(node).text("gmd:codeSpace/*/text()").get();
StringBuilder stringBuilder = new StringBuilder();
if (!StringUtils.isEmpty(codeSpace)) {
代码示例来源:origin: org.n52.security/52n-security-facade
public String getAssertionConsumerUrl() {
return getXpathCtx().findIn(
m_paosResponse).text("//samlp:AuthnRequest/@AssertionConsumerServiceURL").get();
}
代码示例来源:origin: org.n52.security/52n-security-core
/**
* Creates an instance of this class from an XML file.
*
* @param in
* a service excpetion XML document
*
* @return
* @throws org.xml.sax.SAXException
* @throws IOException
*/
public static ServiceException createFromXML(InputSource in) {
Document excDoc = DOMParser.createNew().parse(in);
XMLPathCtx pathCtx = XMLPathCtx.createNew();
String cd = pathCtx.findIn(excDoc).text("//ServiceException/@code").get().trim();
if (cd.equals(""))
cd = "No code available";
String msg = pathCtx.findIn(excDoc).text("//ServiceException/text()").get().trim();
if (msg.equals(""))
msg = "No exception information available";
return new ServiceException(msg, cd);
}
代码示例来源:origin: org.n52.security/52n-security-wss
private List<AuthenticationMethod> getSupportedAuthenticationMethods() {
List<AuthenticationMethod> supportedAuthNMethods = new ArrayList<AuthenticationMethod>();
NodeList authenticationMethodList = m_xPathCtx.findIn(m_capsDoc).all("//authn:AuthenticationMethod").get();
for (int i = 0; i < authenticationMethodList.getLength(); i++) {
org.w3c.dom.Node currentAuthMethod = authenticationMethodList.item(i);
String type = m_xPathCtx.findIn(currentAuthMethod).text("@xsi:type").get();
type = type.substring(type.lastIndexOf(":") + 1);
String method = m_xPathCtx.findIn(currentAuthMethod).text("@method").get();
AuthenticationMethod supportedAuthMethod;
if (type.equals("WASType")) {
org.w3c.dom.Node accAuthNServiceNode = m_xPathCtx.findIn(currentAuthMethod).node("//authn:AuthenticationService").get();
String wasName = m_xPathCtx.findIn(accAuthNServiceNode).text("authn:Name/text()").get();
String wasUrl = m_xPathCtx.findIn(accAuthNServiceNode).text("authn:OnlineResource/@xlink:href").get();
supportedAuthMethod = new org.n52.security.authentication.WASAuthenticationMethod(wasName, wasUrl, "");
} else {
supportedAuthMethod = AuthenticationMethodFactory.getDefault().create(method);
}
supportedAuthNMethods.add(supportedAuthMethod);
}
return supportedAuthNMethods;
}
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
@RequestMapping(value = "/saveTemplate", method = RequestMethod.POST)
public void saveTemplate(HttpServletResponse response) throws Exception {
// get backend document
Document mergeBackend = backendManagerService.mergeBackend();
String title = xmlPathContextFactory.createContext().findIn(mergeBackend).text("//gmd:title/*/text()").get();
try {
templateManager.saveTemplate(title, "MD_Metadata",
userInfoBean.getUserId() != null ? userInfoBean.getUserId() : "",
userInfoBean.getGroupId() != null ? userInfoBean.getGroupId() : "",
"public",
DOMUtil.convertToString(mergeBackend, false));
} catch (Exception e) {
LOG.error(e.getMessage());
response.sendError(500, e.getMessage());
}
LOG.info("Template saved...");
}
}
代码示例来源:origin: org.n52.security/52n-security-wss
/**
* @return
*/
public LicensePrecondition getLicensePrecondition() {
org.w3c.dom.Node licBroClientElement = m_xPathCtx.findIn(m_capsDoc).node("/wss:WSS_Capabilities/wss:Capability/licb:LicensePrecondition/licb:LicenseBrokerClient").get();
if (licBroClientElement == null) {
return null;
}
String licenseRedirectURL = m_xPathCtx.findIn(licBroClientElement).text("licb:RedirectURL/text()").get();
String ssoGetURL = m_xPathCtx.findIn(licBroClientElement).text("licb:SSOGetURL").get();
if (licenseRedirectURL == null && ssoGetURL == null) {
String baseUrl = m_xPathCtx.findIn(licBroClientElement).text("ows:DCP/ows:HTTP/ows:Post/text()").get();
if (baseUrl == null) {
return null;
}
baseUrl = ensureSingleEndingSlash(baseUrl);
licenseRedirectURL = baseUrl + "getOrCreateLicenseToken.faces";
ssoGetURL = baseUrl + "getLicenseToken.faces";
}
LicensePrecondition licensePrecondition = new LicensePrecondition(ssoGetURL.trim(), licenseRedirectURL.trim(), null);
return licensePrecondition;
}
代码示例来源:origin: org.n52.security/52n-security-decision-xacml
private ResponseDocument convertToXACML1XmlBeanResponse(String xmlChunk) {
Document responseChunk = DOMParser.createNew().parse(new InputSource(new StringReader(xmlChunk)));
ResponseDocument responseDoc = ResponseDocument.Factory.newInstance();
ResponseType response = responseDoc.addNewResponse();
ResultType result = response.addNewResult();
result.setDecision(DecisionType.Enum.forString(xmlPathCtx.findIn(responseChunk).text("/c:Response/c:Result[1]/c:Decision/text()").get()));
result.setResourceId(xmlPathCtx.findIn(responseChunk).text("/c:Response/c:Result[1]/@ResourceId").get());
NodeList obligationNodes = xmlPathCtx.findIn(responseChunk).all("/c:Response/c:Result[1]/p:Obligations/*").get();
ObligationsType obligations;
if (obligationNodes.getLength() > 0) {
obligations = result.addNewObligations();
for (int i = 0; i < obligationNodes.getLength(); i++) {
Element oblElem = (Element) obligationNodes.item(i);
fillObligationFromElem(obligations.addNewObligation(), oblElem);
}
}
return responseDoc;
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
/**
* Simply determines the resource type from the current backend
*
* @return
*/
public String getResourceType() {
if (getMergeDocument() != null) {
return xmlPathContextFactory.createContext().findIn(getMergeDocument()).text("//gmd:hierarchyLevel/*/@codeListValue").get();
}
return null;
}
代码示例来源:origin: org.n52.security/52n-security-enforcement-impl
String offeringID = xPath.findIn(offering).text("@gml:id").get();
String lcContent = xPath.findIn(actual).text("gml:Envelope/gml:lowerCorner/text()").get();
String ucContent = xPath.findIn(actual).text("gml:Envelope/gml:upperCorner/text()").get();
String bpContent = xPath.findIn(timePeriod).text("gml:beginPosition/text()").get();
String epContent = xPath.findIn(timePeriod).text("gml:endPosition/text()").get();
代码示例来源:origin: org.n52.security/52n-security-facade
public static SAML2IdPMetadata createFrom(Element idpSsoDescrElement) throws MalformedURLException {
XMLPathCtx xpathCtx = XMLPathCtx.createNew().addNamespace("md", "urn:oasis:names:tc:SAML:2.0:metadata");
NodeList nodeList = xpathCtx.findIn(idpSsoDescrElement).all("md:SingleSignOnService").get();
SAML2IdPMetadata metadata = new SAML2IdPMetadata();
for (int i = 0; i < nodeList.getLength(); i++) {
Element ssoService = (Element) nodeList.item(i);
String binding = ssoService.getAttribute("Binding");
String location = ssoService.getAttribute("Location");
metadata.addSSOBinding(binding, new URL(location));
}
Element organizationElem = (Element) xpathCtx.findIn(idpSsoDescrElement).node("./../md:Organization").get();
if (organizationElem == null) {
String entityID = xpathCtx.findIn(idpSsoDescrElement).text("./../@entityID").get();
metadata.setOrganisationDisplayName(entityID);
} else {
String idpDisplayName = xpathCtx.findIn(organizationElem).text("md:OrganizationDisplayName/text()").get();
metadata.setOrganisationDisplayName(idpDisplayName);
}
return metadata;
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
/**
* validates the backend bean properties against a given schematron (or else) validator
*
* @param target
* @param errors
*/
public void validate(Object target, Errors errors) {
BackendBean lBean = (BackendBean) target;
// chekc if we need to validate
if (lBean.getValidatorId() != null && !lBean.getValidatorId().equals("")) {
// apply schematron transformation
Document lReport = mService.validate(lBean.getValidatorId());
// add assertions to errors.
XMLPathCtx context = xmlPathContextFactory.createContext();
NodeList nodeList = context.findIn(lReport).all("//svrl:failed-assert").get();
for (int i = 0; i < nodeList.getLength(); i++) {
Node lNode = nodeList.item(i);
String id = context.findIn(lNode).text("@id").get();
String text = context.findIn(lNode).text("svrl:text").get();
errors.rejectValue(id,text);
}
}
}
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
private void addNodes(Node pNode, ITreeNode pTreeNode) {
ITreeNode lCurrentNode = new TreeNode();
String lValue = xmlPathContextFactory.createContext().findIn(pNode).text("value").get();
String lName = xmlPathContextFactory.createContext().findIn(pNode).text("name").get();
LOG.debug("Node name is: {}", lName);
LOG.debug("Node value is: {}", lValue);
// add to pTreeNode
if (pTreeNode.getName().equals("")) {
pTreeNode.setId(lValue);
pTreeNode.setName(lName);
pTreeNode.setType(lValue);
lCurrentNode = pTreeNode;
} else {
lCurrentNode.setId(lValue);
lCurrentNode.setName(lName);
lCurrentNode.setType(lValue);
pTreeNode.addChild(lCurrentNode);
}
lCurrentNode.setObject(new HashMap<>(getDefaultOptions()));
LOG.debug("added node with id {}", lCurrentNode.getId());
// has lChildrenList?
NodeList lChildrenList = xmlPathContextFactory.createContext().findIn(pNode).all("./node").get();
if (lChildrenList != null) {
LOG.debug("Node has ChildrenList");
for (int i = 0; i < lChildrenList.getLength(); i++) {
addNodes(lChildrenList.item(i), lCurrentNode);
}
}
LOG.debug("node has no ChildrenList");
}
请帮助我的建议。 我需要通过 xml 文件中的某个变量在我的应用程序上禁用/启用 spring 安全性。 我的 spring-security.xml 文件
我做了很多研究,对我来说一切看起来都是正确的......但我无法让它发挥作用!有人有什么想法吗? 无论我做什么,相关映射仍然对任何人公开(匿名或登录,无论他们具有什么角色)。 理想情况下,我希望所有请
我们正在考虑为我们网站的一部分启用 SSL,但某些页面包含来自第三方供应商(如 Google AdSense)的广告。 我认为这会给我们的用户带来一个恼人的问题,因为他们在查看带有广告的页面时会看到类
我正在开发一个休息服务,它将通过浏览器提供 浏览器单页应用程序和移动应用程序。目前我的服务正在运行 根本没有 Spring 。 oauth2 客户端是在过滤器内部实现的,所以可以说是“手动”。 我正在
我正在为我公司的网站添加 Content-Security-Policy-Report-Only 标题。在我研究它时,我发现一些页面已经设置了 Content-Security-Policy head
在 XML 配置中,我可以使用 security 命名空间来启用对安全性的支持,例如: 我尝试使用没有 XML 的 Spring,只有 @Configuration 类。与上述 XM
我正在使用 Spring Security 3.0.2,但找不到从数据库加载匿名用户角色的方法(我有动态角色,可以将角色分配给每个人)。 我尝试使用自定义的anonymousAuthenticatio
我有那个代码。但是当我在浏览器中进入 app_dev.php/login浏览器说:该页面进行了太多重定向 安全.yml安全: 编码器: Symfony\Component\Security\Core\
我正在使用SSH Secure Shell客户端,这是一个连接服务器的好工具。 但是,我想知道是否可以记录通过SSH Secure Shell客户端运行的程序中所有即将出现的消息。例如:./ test
我有那个代码。但是当我在浏览器中进入 app_dev.php/login浏览器说:该页面进行了太多重定向 安全.yml安全: 编码器: Symfony\Component\Security\Core\
如何为表单例份验证提供程序设置 success_handler(和 failure_handler)? Silex 使用此配置忽略我: register(new Silex\Provider\Secu
新手问题...我已成功实现自定义处理程序和服务(自定义用户详细信息服务、身份验证成功、身份验证失败)并且一切正常。我现在还实现了如果 3 次并发身份验证失败将锁定帐户(一定时间)的功能。 我现在继续处
我正在使用 Spring security java 配置,我想知道一种实现多个 url 注销的方法。即 logout().logoutRequestMatcher(new AntPathReques
我正在为我的 SP 使用 Spring Security SAML 扩展。用户通过 IDP 身份验证后,SP 使用某种方法允许后续调用不必通过 IDP 重新进行身份验证。这是如何在 Spring Se
spring security 有没有办法防止下面的最后一点?我正在使用 3.0.5 - 用户登录我的网站 - 用户转到网站中的任何页面并单击注销 -注销链接使用户 session 无效并将它们发送到
要么我迟到了,要么我做错了什么。我正在使用 Visual Studio 2013,但是我试图使用 Membership 类,using System.Web.Security;我的程序集中不存在命名空
我有一个具有依赖性的oauth2客户端spring-boot应用程序: - Spring 靴1.2.0.RC1 -spring-security-oauth2 2.0.4.RELEASE - Spri
我想在控制台应用程序中生成 HashPasswordForStoringInConfigFile。 它是在 Web 应用程序中使用以下类完成的 System.Web.Security.FormsAut
我需要有多个 PRE_AUTH Spring 安全过滤器。特别是我需要使用 PRE_AUTH除了配置为 PRE_AUTH 的两个过滤器之外的过滤器在 Spring Security 3.0 的 SAM
我猜这里没有答案,但我想知道是否有办法创建这样的自定义注释: @Documented @Inherited @Retention(RetentionPolicy.RUNTIME) @Target({E
我是一名优秀的程序员,十分优秀!