广州网站设计专注乐云seo网站制作昆山

web/2025/10/6 11:38:56/文章来源:
广州网站设计专注乐云seo,网站制作昆山,wordpress 过滤html代码,wordpress一键ssl今年的开局很好#xff0c;其中另一个“截止日期不会改变” /“跳过所有繁文tape节” / “狂野西部”类型的项目中#xff0c;我必须弄清楚并使用相对而言实现一些功能。新的库和技术需要进行更改#xff0c;Spring 3并不是新增功能#xff0c;但是在Java 5#xff0c;web… 今年的开局很好其中另一个“截止日期不会改变” /“跳过所有繁文tape节” / “狂野西部”类型的项目中我必须弄清楚并使用相对而言实现一些功能。新的库和技术需要进行更改Spring 3并不是新增功能但是在Java 5weblogic 10.01和Spring 2.5.6缓慢的企业环境中它是相对的。 由于一般的时间限制我在这篇文章中没有过多地介绍“ fluff”只是使用多个XSD和LDAP安全性来创建和保护Spring 3Spring WS 2 Web服务。 编码 服务端点ExampleServiceEndpoint 这是将在后面的配置中使用Web服务公开的类。 package javaitzen.spring.ws;import org.springframework.ws.server.endpoint.annotation.Endpoint; import org.springframework.ws.server.endpoint.annotation.PayloadRoot; import org.springframework.ws.server.endpoint.annotation.RequestPayload; import org.springframework.ws.server.endpoint.annotation.ResponsePayload;import javax.annotation.Resource;Endpoint public class ExampleServiceEndpoint {private static final String NAMESPACE_URI http://www.briandupreez.net;/*** Autowire a POJO to handle the business logicResource(name businessComponent)private ComponentInterface businessComponent;*/public ExampleServiceEndpoint() {System.out.println( javaitzen.spring.ws.ExampleServiceEndpoint loaded.);}PayloadRoot(localPart ProcessExample1Request, namespace NAMESPACE_URI /example1)ResponsePayloadpublic Example1Response processExample1Request(RequestPayload final Example1 request) {System.out.println( process example request1 ran.);return new Example1Response();}PayloadRoot(localPart ProcessExample2Request, namespace NAMESPACE_URI /example2)ResponsePayloadpublic Example2Response processExample2Request(RequestPayload final Example2 request) {System.out.println( process example request2 ran.);return new Example2Response();}} 代码CustomValidationCallbackHandler 这是我编写的用于扩展AbstactCallbackHandler的自定义代码它允许我们使用LDAP。 根据下面的CallbackHandler中的注释根据安全性/性能考虑最好有一个缓存管理器如Hazelcast或Ehcache来缓存经过身份验证的用户。 下面的Digest Validator可以直接从Sun库中使用我只是想了解它是如何工作的。 package javaitzen.spring.ws;import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException; import com.sun.xml.wss.impl.callback.PasswordValidationCallback; import com.sun.xml.wss.impl.misc.Base64; import org.springframework.beans.factory.InitializingBean; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.util.Assert; import org.springframework.ws.soap.security.callback.AbstractCallbackHandler;import javax.security.auth.callback.Callback; import javax.security.auth.callback.UnsupportedCallbackException; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.util.Properties;public class CustomValidationCallbackHandler extends AbstractCallbackHandler implements InitializingBean {private Properties users new Properties();private AuthenticationManager ldapAuthenticationManager;Overrideprotected void handleInternal(final Callback callback) throws IOException, UnsupportedCallbackException {if (callback instanceof PasswordValidationCallback) {final PasswordValidationCallback passwordCallback (PasswordValidationCallback) callback;if (passwordCallback.getRequest() instanceof PasswordValidationCallback.DigestPasswordRequest) {final PasswordValidationCallback.DigestPasswordRequest digestPasswordRequest (PasswordValidationCallback.DigestPasswordRequest) passwordCallback.getRequest();final String password users.getProperty(digestPasswordRequest.getUsername());digestPasswordRequest.setPassword(password);passwordCallback.setValidator(new CustomDigestPasswordValidator());}if (passwordCallback.getRequest() instanceof PasswordValidationCallback.PlainTextPasswordRequest) {passwordCallback.setValidator(new LDAPPlainTextPasswordValidator());}} else {throw new UnsupportedCallbackException(callback);}}/*** Digest Validator.* This code is directly from the sun class, I was just curious how it worked.*/private class CustomDigestPasswordValidator implements PasswordValidationCallback.PasswordValidator {public boolean validate(final PasswordValidationCallback.Request request) throws PasswordValidationCallback.PasswordValidationException {final PasswordValidationCallback.DigestPasswordRequest req (PasswordValidationCallback.DigestPasswordRequest) request;final String passwd req.getPassword();final String nonce req.getNonce();final String created req.getCreated();final String passwordDigest req.getDigest();final String username req.getUsername();if (null passwd)return false;byte[] decodedNonce null;if (null ! nonce) {try {decodedNonce Base64.decode(nonce);} catch (final Base64DecodingException bde) {throw new PasswordValidationCallback.PasswordValidationException(bde);}}String utf8String ;if (created ! null) {utf8String created;}utf8String passwd;final byte[] utf8Bytes;try {utf8Bytes utf8String.getBytes(utf-8);} catch (final UnsupportedEncodingException uee) {throw new PasswordValidationCallback.PasswordValidationException(uee);}final byte[] bytesToHash;if (decodedNonce ! null) {bytesToHash new byte[utf8Bytes.length decodedNonce.length];for (int i 0; i decodedNonce.length; i)bytesToHash[i] decodedNonce[i];for (int i decodedNonce.length;i utf8Bytes.length decodedNonce.length;i)bytesToHash[i] utf8Bytes[i - decodedNonce.length];} else {bytesToHash utf8Bytes;}final byte[] hash;try {final MessageDigest sha MessageDigest.getInstance(SHA-1);hash sha.digest(bytesToHash);} catch (final Exception e) {throw new PasswordValidationCallback.PasswordValidationException(Password Digest could not be created e);}return (passwordDigest.equals(Base64.encode(hash)));}}/*** LDAP Plain Text validator.*/private class LDAPPlainTextPasswordValidator implementsPasswordValidationCallback.PasswordValidator {/*** Validate the callback against the injected LDAP server.* Probably a good idea to have a cache manager - ehcache / hazelcast injected to cache authenticated users.** param request the callback request* return true if login successful* throws PasswordValidationCallback.PasswordValidationException**/public boolean validate(final PasswordValidationCallback.Request request) throws PasswordValidationCallback.PasswordValidationException {final PasswordValidationCallback.PlainTextPasswordRequest plainTextPasswordRequest (PasswordValidationCallback.PlainTextPasswordRequest) request;final String username plainTextPasswordRequest.getUsername();final Authentication authentication;final Authentication userPassAuth new UsernamePasswordAuthenticationToken(username, plainTextPasswordRequest.getPassword());authentication ldapAuthenticationManager.authenticate(userPassAuth);return authentication.isAuthenticated();}}/*** Assert users.** throws Exception error*/public void afterPropertiesSet() throws Exception {Assert.notNull(users, Users is required.);Assert.notNull(this.ldapAuthenticationManager, A LDAP Authentication manager is required.);}/*** Sets the users to validate against. Property names are usernames, property values are passwords.** param users the users*/public void setUsers(final Properties users) {this.users users;}/*** The the authentication manager.** param ldapAuthenticationManager the provider*/public void setLdapAuthenticationManager(final AuthenticationManager ldapAuthenticationManager) {this.ldapAuthenticationManager ldapAuthenticationManager;} } 服务配置 端点CallbackHandler和LDAP身份验证管理器的配置。 应用程序上下文–服务器端 ?xml version1.0 encodingUTF-8? beans xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlnshttp://www.springframework.org/schema/beansxmlns:contexthttp://www.springframework.org/schema/contextxmlns:swshttp://www.springframework.org/schema/web-servicesxmlns:shttp://www.springframework.org/schema/securityxsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/web-serviceshttp://www.springframework.org/schema/web-services/web-services-2.0.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/securityhttp://www.springframework.org/schema/security/spring-security-3.0.xsdsws:annotation-driven/context:component-scan base-packagejavaitzen.spring.ws/sws:dynamic-wsdl idexampleServiceportTypeNamejavaitzen.spring.ws.ExampleServiceEndpointlocationUri/exampleService/targetNamespacehttp://www.briandupreez.net/exampleServicesws:xsd locationclasspath:/xsd/Example1Request.xsd/sws:xsd locationclasspath:/xsd/Example1Response.xsd/sws:xsd locationclasspath:/xsd/Example2Request.xsd/sws:xsd locationclasspath:/xsd/Example2Response.xsd//sws:dynamic-wsdlsws:interceptorsbean idvalidatingInterceptorclassorg.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptorproperty nameschema valueclasspath:/xsd/Example1Request.xsd/property namevalidateRequest valuetrue/property namevalidateResponse valuetrue//beanbean idloggingInterceptorclassorg.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor/bean classorg.springframework.ws.soap.security.xwss.XwsSecurityInterceptorproperty namepolicyConfiguration value/WEB-INF/securityPolicy.xml/property namecallbackHandlerslistref beancallbackHandler//list/property/bean/sws:interceptorsbean idcallbackHandler classjavaitzen.spring.ws.CustomValidationCallbackHandlerproperty nameldapAuthenticationManager refauthManager //beans:authentication-manager aliasauthManagers:ldap-authentication-provideruser-search-filter(uid{0})user-search-baseouusersgroup-role-attributecnrole-prefixROLE_/s:ldap-authentication-provider/s:authentication-manager!-- Example... (inmemory apache ldap service) --s:ldap-server idcontextSource rootoexample ldifclasspath:example.ldif/!--If you want to connect to a real LDAP server it would look more like:s:ldap-server idcontextSource urlldap://localhost:7001/oexample manager-dnuidadmin,ousystem manager-passwordsecret/s:ldap-server--bean idmarshallingPayloadMethodProcessorclassorg.springframework.ws.server.endpoint.adapter.method.MarshallingPayloadMethodProcessorconstructor-arg refserviceMarshaller/constructor-arg refserviceMarshaller//beanbean iddefaultMethodEndpointAdapterclassorg.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapterproperty namemethodArgumentResolverslistref beanmarshallingPayloadMethodProcessor//list/propertyproperty namemethodReturnValueHandlerslistref beanmarshallingPayloadMethodProcessor//list/property/beanbean idserviceMarshaller classorg.springframework.oxm.jaxb.Jaxb2Marshallerproperty nameclassesToBeBoundlistvaluejavaitzen.spring.ws.Example1/valuevaluejavaitzen.spring.ws.Example1Response/valuevaluejavaitzen.spring.ws.Example2/valuevaluejavaitzen.spring.ws.Example2Response/value/list/propertyproperty namemarshallerPropertiesmapentry keyjaxb.formatted.outputvalue typejava.lang.Booleantrue/value/entry/map/property/bean/beans 安全上下文–服务器端 xwss:SecurityConfiguration xmlns:xwsshttp://java.sun.com/xml/ns/xwss/configxwss:RequireTimestamp maxClockSkew60 timestampFreshnessLimit300/!-- Expect plain text tokens from the client --xwss:RequireUsernameToken passwordDigestRequiredfalse nonceRequiredfalse/xwss:Timestamp/!-- server side reply token --xwss:UsernameToken nameserver passwordserver1 digestPasswordfalse useNoncefalse/ /xwss:SecurityConfiguration Web XML 这里没有什么特别的只是Spring WS MessageDispatcherServlet。 spring-wsorg.springframework.ws.transport.http.MessageDispatcherServlettransformWsdlLocationstrue1spring-ws/* 客户端配置 要测试或使用该服务您需要 应用程序上下文–客户端测试 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdbean idmessageFactory classorg.springframework.ws.soap.saaj.SaajSoapMessageFactory/bean idwebServiceTemplate classorg.springframework.ws.client.core.WebServiceTemplateconstructor-arg refmessageFactory/property namemarshaller refserviceMarshaller/property nameunmarshaller refserviceMarshaller/property namedefaultUri valuehttp://localhost:7001/example/spring-ws/exampleService/property nameinterceptorslistref localxwsSecurityInterceptor//list/property/beanbean idxwsSecurityInterceptorclassorg.springframework.ws.soap.security.xwss.XwsSecurityInterceptorproperty namepolicyConfiguration valuetestSecurityPolicy.xml/property namecallbackHandlerslistref beancallbackHandler//list/property/bean!-- As a client the username and password generated by the server must match with the client! --!-- a simple callback handler to configure users and passwords with an in-memory Properties object. --bean idcallbackHandlerclassorg.springframework.ws.soap.security.xwss.callback.SimplePasswordValidationCallbackHandlerproperty nameuserspropsprop keyserverserver1/prop/props/property/beanbean idserviceMarshaller classorg.springframework.oxm.jaxb.Jaxb2Marshallerproperty nameclassesToBeBoundlistvaluejavaitzen.spring.ws.Example1/valuevaluejavaitzen.spring.ws.Example1Response/valuevaluejavaitzen.spring.ws.Example2/valuevaluejavaitzen.spring.ws.Example2Response/value/list/propertyproperty namemarshallerPropertiesmapentry keyjaxb.formatted.outputvalue typejava.lang.Booleantrue/value/entry/map/property/bean 安全上下文–客户端 xwss:SecurityConfiguration xmlns:xwsshttp://java.sun.com/xml/ns/xwss/configxwss:RequireTimestamp maxClockSkew60 timestampFreshnessLimit300/!-- Expect a plain text reply from the server --xwss:RequireUsernameToken passwordDigestRequiredfalse nonceRequiredfalse/xwss:Timestamp/!-- Client sending to server --xwss:UsernameToken nameexample passwordpass digestPasswordfalse useNoncefalse/ /xwss:SecurityConfiguration 与Java通常一样在jar和版本方面可能会有一些细微差别因此下面是我使用的pom的一部分。 依赖关系 3.0.6.RELEASE2.0.2.RELEASEorg.apache.directory.serverapacheds-all1.5.5jarcompileorg.springframework.wsspring-ws-core${spring-ws-version}org.springframeworkspring-webmvc${spring-version}org.springframeworkspring-web${spring-version}org.springframeworkspring-context${spring-version}org.springframeworkspring-core${spring-version}org.springframeworkspring-beans${spring-version}org.springframeworkspring-oxm${spring-version}org.springframework.wsspring-ws-security${spring-ws-version}org.springframework.securityspring-security-core${spring-version}org.springframework.securityspring-security-ldap${spring-version}org.springframework.ldapspring-ldap-core1.3.0.RELEASEorg.apache.ws.securitywss4j1.5.12com.sun.xml.wssxws-security3.0org.apache.ws.commons.schemaXmlSchema1.4.2/project 参考 Spring 3Spring Web Services 2和LDAP安全性。 来自我们的JCG合作伙伴   Zen博客中的Zen领域的 Brian Du Preez。 翻译自: https://www.javacodegeeks.com/2012/02/spring-3-spring-web-services-2-ldap.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/87888.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

备案网站建设承诺书昆明专业做网站多少钱

今日在服务器上创建anaconda虚拟环境的时候,出现了如下报错 An unexpected error has occurred. Conda has prepared the above report 直接上解决方案 在终端中输入如下指令 conda config --show-sources 如果出现以下提示,说明多了一个文件 输入以下…

新老网站做301跳转宁波企业网站制作哪家好

文章目录 一、简介二、设计2.1 队列结构设计2.2 队列接口设计 三、实现3.1 队列锁的实现3.2 创建队列3.3 写入队列3.4 读出数据3.5 判断队列是否为空3.6 判断队列是否为满3.7 清空队列3.8 删除队列 四、测试参考 一、简介 收到消息时先把接收到的消息放到队列中。在任务中从队…

工业和信息化部网站备案系统是什么无线网网址是什么

win7访问Linux Samba的共享目录提示“登录失败:用户名或密码错误”解决方法 解决办法:修改本地安全策略 通过Samba服务可以实现UNIX/Linux主机与Windows主机之间的资源互访,由于实验需要,轻车熟路的在linux下配置了samba服务&…

宝安网站建设深圳信科亚马逊全球开店app下载

回归预测 | Matlab实现WOA-CNN-SVM鲸鱼算法优化卷积神经网络-支持向量机的多输入单输出回归预测 目录 回归预测 | Matlab实现WOA-CNN-SVM鲸鱼算法优化卷积神经网络-支持向量机的多输入单输出回归预测效果一览基本介绍程序设计参考资料 效果一览 基本介绍 1.WOA-CNN-SVM鲸鱼算法…

博客网站开发背景推广品牌的方法

目录 堆排序 整体思路 代码实现 Q1建大堆/小堆 Q2数据个数和下标 TopK问题 整体思路 代码实现 Q1造数据CreateData Q2建大堆/小堆 建堆的两种方法这里会用到前面的向上/向下调整/交换函数。向上调整&向下调整算法-CSDN博客 堆排序 整体思路 建堆(直…

网站建设整个流程图让搜索引擎收录网站

作为一个新手,配置这个yum源配了4天,遇到了各种问题,也按照网络上面一些方法在163上面下载CentOS6的yum源来替换Redhat本地的yum源,但是配置过程中,出现很多错误,发现直接在本地配置yum源会更便捷一点&…

亚成成品网站源码企业网站建设湖南岚鸿

古雷150万吨乙烯,为啥叫芒果项目?福建石油化工集团有限责任公司9月1日在福州举行的一场新闻通气会上透露,石化基地引进世界化工巨头——沙特基础工业公司(简称SABIC),合资合作共建中沙古雷乙烯项目。中沙古雷乙烯项目将在福建古雷…

网站建设免费建站源代码沧州市住房和城乡建设局网站

Java可执行命令之jinfo 1️⃣ 概念2️⃣ 优势和缺点3️⃣ 使用3.1 语法格式3.2 -flags&#xff1a;查看进程的启动参数3.3 -sysprops&#xff1a;查看进程的系统属性3.4 -flag < name>&#xff1a;查看特定虚拟机参数的值3.5 -flag [/-]< name>&#xff1a;启用或禁…

网站建设seo视频教程物流信息网站建设

发展历程-http组成-http是什么-相关的应用-相关的协议 参考来源&#xff1a; 极客时间-透视HTTP协议(作者&#xff1a;罗剑锋)&#xff1b; 01-HTTP的发展历程 1989 年&#xff0c;任职于欧洲核子研究中心&#xff08;CERN&#xff09;的蒂姆伯纳斯 - 李&#xff08;Tim Ber…

网站是做流程网站建设基础报告

一 内网环境安装docker 先在外网环境下载好docker二进制文件docker二进制文件下载&#xff0c;要下载对应硬件平台的文件&#xff0c;否则不兼容 如下载linux平台下的文件&#xff0c;直接访问这里即可linux版本docker二进制文件 这里下载docker-24.0.5.tgz 将下载好的文件…

做资讯类网站需要什么资质网站开发用什么图片格式最好

一、直接插入排序基本思想 直接插入排序(straight insertion sort)的做法是&#xff1a;每次从无序表中取出第一个元素&#xff0c;把它插入到有序表的合适位置&#xff0c;使有序表仍然有序。第一趟比较前两个数&#xff0c;然后把第二个数按大小插入到有序表中&#xff1b; 第…

如何自己做企业网站网页搜索一个网站全包

人情世故是我们日常生活中积累的约定俗成的行为规则&#xff0c;属于社会知识的范畴。这些知识大半来源于与不同人群的社会交际&#xff0c;也来源于社会冲突与社会发展。在有专业知识与技能的情况下&#xff0c;人情世故能够帮助我们个人缓和与其他人之间的紧张度&#xff0c;…

企业网站如何建立wordpress广告链接不跳转

一、什么是AJAX 1.AJAX 就是异步的JS和XML。通过AJAX 可以在浏览器中向服务器发送异步请求&#xff0c;最大的优势&#xff1a;无刷新获取数据。AJAX 不是新的编程语言&#xff0c;而是一种将现有的标准组合在一起使用的新方式。 2.XML 可扩展标记语言。XML被设计用来传输和…

中文旅游网站html模板天津网站排名提升多少钱

目录 一、Tomcat 介绍 二、Tomcat 核心技术和组件 2.1、Web 容器&#xff1a;完成 Web 服务器的功能 2.2、Servlet 容器&#xff0c;名字为 catalina&#xff0c;用于处理 Servlet 代码 2.3、JSP 容器&#xff1a;用于将 JSP 动态网页翻译成 Servlet 代码 Tomcat 功能组件…

网站的构成元素做网站线稿软件有哪些

这两天在研究整理上课数据库和web要求安装操作的软件 晚点再写下去 1.SQL server 2012 安装的过程中出现不少问题&#xff0c;根据网上的教程以及老师发的实验指导书首先安装SQL server (1)在安装规则检测之后&#xff0c;没有按照步骤进入下一步——设置角色&#xff1b; …

免费自助建站系统下载营销最好的方法

XPath语法规则及实例 XPath语法规则一、XPath术语&#xff1a; 1.节点&#xff1a;在XPath中&#xff0c;有七种类型的节点&#xff1a;元素、属性、文本、命名空间、处理指令、注释以及文档&#xff08;根&#xff09;节点。 XML文档是被作为节点树来对待的。树的根被称为文档…

佛山制作网站公司吗国外网站建立

在Hive中使用Python编写的UDF函数&#xff0c;需要通过Hive的brickhouse库来实现。brickhouse库提供了一种将Python UDF函数与Hive集成的方法。以下是一个简单的示例&#xff0c;演示如何在Hive中使用Python编写的UDF函数transform&#xff1a; 首先&#xff0c;您需要安装bri…

网站建设项目进展情况网络加盟

第三章总结 栈与队列都是特殊的限制型的线性表&#xff0c;通常没有查询这个操作 栈的特点就是先进后出&#xff0c;只可以在栈顶进行插入删除&#xff0c;顺序栈定义指向栈顶与栈底的指针&#xff08;方便判断栈的情况&#xff09;也可以只定义一个栈顶指针top然后通过top-1来…

鞍山网站制作人才招聘专业建站源码

MATLAB目前只支持Nvidia的显卡。如果你的显卡是AMD的或者是Intel的&#xff0c;就得考虑另寻它路了。 MATLAB可谓工程计算中的神器&#xff0c;一方面它自带丰富的函数库&#xff0c;另一方面它所有的数据都是内建的矩阵类型&#xff0c;最后画图也方便&#xff0c;因此解决一…

如何建立免费微网站wordpress 按时间倒序

在Linux系统中&#xff0c;环境变量LANG、LC_MESSAGES和LC_ALL用于控制系统和应用程序的语言和区域设置&#xff08;locale&#xff09;。它们的具体作用如下&#xff1a; LANG&#xff1a; LANG是最基本的环境变量&#xff0c;用于指定系统的默认语言和区域设置。它是一个全局…