当前位置: 首页 > news >正文

青岛教育平台网站建设wordpress自动链接到图片大小

青岛教育平台网站建设,wordpress自动链接到图片大小,湛江大型网站模板建设,昆明网络建站公司一 您可以在Spring XML配置文件中指定您选择的授权提供者。 您可以通过配置Spring的http://www.springframework.org/schema/security/spring-security-3.1.xsd模式中定义的authentication-manager来实现。 简化的authentication-manager元素定义看起来像这样#xff1a; xs:element nameauthentication-managerxs:complexTypexs:choice minOccurs0 maxOccursunboundedxs:element nameauthentication-providerxs:complexTypexs:choice minOccurs0 maxOccursunboundedxs:element refsecurity:any-user-service/xs:element namepassword-encoder.../xs:element/xs:choicexs:attributeGroup refsecurity:ap.attlist//xs:complexType/xs:element!-- This is BIG --xs:element nameldap-authentication-provider.../xs:element/xs:choicexs:attributeGroup refsecurity:authman.attlist//xs:complexType /xs:element 这意味着例如您可以使用任何数量的身份验证提供程序包括基本身份验证和JDBC身份验证如下面的代码段所示 authentication-manager aliasauthenticationManagerauthentication-provideruser-serviceuser authoritiesROLE_GUEST nameguest password//user-service/authentication-providerauthentication-providerjdbc-user-service data-source-refdataSource//authentication-provider/authentication-manager 二 您可以使用intercept-url元素将URL链接到用户角色从而在Spring XML文件中配置授权规则。 intercept-url元素是http元素的子元素其简短定义如下所示 xs:element namehttpxs:complexTypexs:choice minOccurs0 maxOccursunboundedxs:element nameintercept-urlxs:complexTypexs:attributeGroup refsecurity:intercept-url.attlist//xs:complexType/xs:element!-- Details omitted for clarity --xs:element nameaccess-denied-handler.../xs:elementxs:element nameform-login.../xs:elementxs:element nameopenid-login.../xs:elementxs:element namex509.../xs:elementxs:element refsecurity:jee/xs:element namehttp-basic.../xs:elementxs:element namelogout.../xs:elementxs:element namesession-management.../xs:elementxs:element nameremember-me.../xs:elementxs:element nameanonymous.../xs:elementxs:element nameport-mappings.../xs:elementxs:element refsecurity:custom-filter/xs:element refsecurity:request-cache/xs:element nameexpression-handler.../xs:element/xs:choicexs:attributeGroup refsecurity:http.attlist//xs:complexType /xs:element 用法示例 security:httpsecurity:intercept-url pattern/admin/** accesshasRole(ROLE_ADMIN)/security:intercept-url pattern/account/** accesshasRole(ROLE_USER) /security:intercept-url pattern/** accesshasRole(ROLE_ANONYMOUS) /!-- other elements removed for clarity -- /security:http 三 您可以使用几个实现Spring的org.springframework.security.authentication.encoding.PasswordEncoder接口的类对密码进行编码和验证。 这只有两种方法 encodePassword和isPasswordValid 。 它的许多实现包括 BaseDigestPasswordEncoder BasePasswordEncoder LdapShaPasswordEncoder Md4PasswordEncoder Md5PasswordEncoder MessageDigestPasswordEncoder MessageDigestPasswordEncoder PlaintextPasswordEncoder ShaPasswordEncoder 四个 您可以使用Spring Security的标签库来限制对页面元素的访问。 要使用此库您需要在JSP中包含以下taglib定义 % taglib prefixsec urihttp://www.springframework.org/security/tags % taglib包含三个有用的标签 授权 认证方式 访问控制表 最有用的似乎是authorize标记以Spring文档中的示例为例可以以两种方式使用它。 首先您可以授权角色 sec:authorize accesshasRole(supervisor) This content will only be visible to users who have the supervisor authority in their list of ttGrantedAuthority/tts. /sec:authorize …其次您可以针对网址进行授权 sec:authorize url/admin This content will only be visible to users who are authorized to send requests to the /admin URL. /sec:authorize 指定的URL必须与第2项中所述的intercept-url标记配合使用。 五 您可以使用Spring的内部注释执行方法级别的授权 PreAuthorize(spEL expression) PostAuthorize(spEL expression) Secure spEL表达式可以是任何东西但通常类似于 hasRole(ROLE_USER) 。 要启用PreAuthorize(...)和PostAuthorize(...)请将以下内容添加到XML配置文件中 global-method-security pre-post-annotationsenabled / 如以下示例所示使用PreAuthorize(...) span classjava0br //spanspan classjava16PreAuthorize/spanspan classjava8(/spanspan classjava5hasRole(ROLE_ADMIN)/spanspan classjava8) br //spanspan classjava4public /spanspan classjava9void /spanspan classjava10deleteUser/spanspan classjava8(/spanspan classjava10String username/spanspan classjava8)/spanspan classjava10;br / /span 要启用Secure请将以下内容添加到您的Spring配置文件中 global-method-security pre-post-annotationsenabled / 六 您可以通过将以下内容添加到Spring配置文件中使用Spring的JSR-250实现来执行方法级安全性 global-method-security jsr250-annotations”enabled”/ 的JSR-250安全注解是一个子集的JSR-250注解和包括 RolesAllowed({“ROLE_USER”,”ROLE_ADMIN”}) PermitAll DenyAll 使用时JSR-250注释看起来像这样 RolesAllowed({ROLE_ADMIN,ROLE_USER}) public void deleteUser(String username); 七 您可以通过几个简单的步骤将Spring Security与OpenID身份验证集成。 其中的第一步是编写一个简单的JSP表单其中将操作值设置为j_spring_openid_security_check 该表单的最小值看起来像这样 form actionj_spring-openid-security-check methodpostlabel foropenid_idenifierLogin/label: input idopenid_identifier nameopenid_identifier typetext/input typesubmit valueLogin / /form 下一步是将openid-login元素添加到http xs:element namehttpxs:complexTypexs:choice minOccurs0 maxOccursunboundedxs:element nameopenid-loginxs:annotationxs:documentationSets up form login for authentication with anOpen ID identity/xs:documentation/xs:annotationxs:complexTypexs:sequencexs:element minOccurs0 maxOccursunboundedrefsecurity:attribute-exchange //xs:sequencexs:attributeGroup refsecurity:form-login.attlist /xs:attribute nameuser-service-ref typexs:tokenxs:annotationxs:documentationA reference to a user-service (orUserDetailsService bean) Id/xs:documentation/xs:annotation/xs:attribute/xs:complexType/xs:element!-- Other elements omitted for clarity --/xs:choice/xs:complexType /xs:element 由于所有openid-login子元素都是可选的因此启用OpenID的最简单方法是编写 http auto-configtrueopenid-login/!-- other tags and attributes omitted for clarity -- /http 最后您需要将spring-security-openid.jar到您的项目中。 八 您可以将应用程序配置为使用XML配置通过嵌入式LDAP轻型目录访问协议服务器对用户进行身份验证。 下面显示的简化XML模式对此进行了描述 xs:element nameldap-serverxs:complexTypexs:attributeGroup refsecurity:ldap-server.attlist //xs:complexType /xs:element xs:attributeGroup nameldap-server.attlistxs:attribute nameid typexs:tokenxs:annotationxs:documentationA bean identifier, used for referring to the bean elsewhere in the context./xs:documentation/xs:annotation/xs:attributexs:attribute nameport typexs:positiveInteger/xs:attribute nameldif typexs:stringxs:annotationxs:documentationExplicitly specifies an ldif file resource to loadinto an embedded LDAPserver. The default is classpath*:*.ldiff/xs:documentation/xs:annotation/xs:attributexs:attribute nameroot typexs:stringxs:annotationxs:documentationOptional root suffix for the embedded LDAP server. Default isdcspringframework,dcorg/xs:documentation/xs:annotation/xs:attribute /xs:attributeGroup LDIF文件 LDIF代表LDAP交换格式是一种纯文本文件格式用于描述一组LDAP记录。 ldap-server元素用法的一个示例是 ldap-server ldifclasspath:my-ldif-file.ldif idlocalserver / 要使用Spring Security LDAP集成请记住在项目的POM.XML中包含spring-security-ldap.jar jar。 九 您可以将应用程序配置为使用XML配置通过远程LDAP轻型目录访问协议服务器对用户进行身份验证。 下面显示的简化XML模式对此进行了描述 xs:element nameldap-serverxs:complexTypexs:attributeGroup refsecurity:ldap-server.attlist //xs:complexType /xs:element xs:attributeGroup nameldap-server.attlistxs:attribute nameid typexs:tokenxs:annotationxs:documentationA bean identifier, used for referring to the bean elsewhere in the context./xs:documentation/xs:annotation/xs:attributexs:attribute nameurl typexs:token/xs:attribute nameport typexs:positiveInteger/xs:attribute namemanager-dn typexs:stringxs:annotationxs:documentationUsername (DN) of the manager user identity which will be used toauthenticate to a (non-embedded) LDAP server. If omitted, anonymousaccess will be used./xs:documentation/xs:annotation/xs:attributexs:attribute namemanager-password typexs:stringxs:annotationxs:documentationThe password for the manager DN. This is requiredif the manager-dn is specified./xs:documentation/xs:annotation/xs:attribute /xs:attributeGroup 文档指出ldap-server元素“定义LDAP服务器位置或启动嵌入式服务器。 URL指示远程服务器的位置。 如果未提供url则将启动嵌入式服务器监听提供的端口号。 该端口是可选的默认为33389。将使用提供的ID为服务器注册Spring LDAP ContextSource bean。 这是一个非常简单的配置示例 ldap-server urlldap://myServer/dccaptaindebug,dccom:389 idldapExternal manager-dnuidadmin,ouusers,ousystems manager-passwords3cret/ 配置服务器后还需要配置LDAP身份验证提供程序。 似乎有几种方法可以做到这一点但它并不是那么简单所以以后可能会更多…… 十 您可以添加 Spring Security Config的intercept-url /元素requires-channelhttps属性强制所有匹配的URL使用HTTPS。 例如如果要确保在发送密码之前始终对密码进行加密则可以将此简化的XML添加到配置中 http auto-configtrue use-expressionstrueintercept-url pattern/login requires-channelhttps/!-- Other attributes and elements omitted -- /https 这里还有另外几件事要做但稍后会做更多…… 您可能已经注意到我已经使用Spring Security XML模式文件 http://www.springframework.org/schema/security/spring-security-3.1.xsd 来解释清单中的某些功能。可以使用Spring Security。 这是因为我一直将Spring XSD视为Spring所有事物的确定参考点。 2011年11月我在Spring的JSR-250的PostConstruct Annotation上写了一个博客其中包含一个错误是的的确确实发生了Spring的Chris Beams – CBeams正确地指出了这一点他在JavaLobby上发表了评论。此博客的版本 。 我决定检查架构发现我们俩都错了尽管我比克里斯错了很多–就我所知《 机长调试 》一书现在是正确的。 应用程序安全性是一个相当复杂的主题如果您要深入研究它那么我建议您获得Peter Mularien的Spring Security 3的副本- Spring的Guys也建议您这样做。 最后如果有一个关于Spring Security的关键想法值得欣赏那就是作为应用程序的附加功能它提供了非常丰富的安全功能集。 因此您应该尝试让Spring Security尽可能多地处理应用程序的安全细节而不是深入研究和不必要地编写自己的代码。 参考 Captain Debugs Blog博客上的JCG合作伙伴 Roger Hughes提供的Spring Security可以做的十件事 。 翻译自: https://www.javacodegeeks.com/2012/11/ten-things-you-can-do-with-spring-security.html
http://www.pierceye.com/news/780695/

相关文章:

  • 南昌建设局网站查询塔吊证怎么查福州seo网站建设
  • 机关内网站建设方案书给人做传销网站
  • 厦门有什么网站制作公司邢台太行中学简介
  • 天合建设集团网站做一个网站得做多少个页面
  • 做衣服接订单的网站网站用哪些系统做的
  • 爱美刻在线制作网站罗村网站制作公司
  • 现在网站用什么软件做免费的会计做账系统
  • 国外的包装设计网站三明网站设计
  • 网站源码怎样弄成网站工商登记网站
  • 2016做砸了的小网站一键创建网站
  • 怎么制作网站域名六安网站制作人才招聘
  • 网站建设 启象科技上海公司排名100强
  • 户外旅游网站排名深圳seo专家
  • 娄底建设网站的公司深圳人才招聘网
  • 网站建设和制作网站名称设置
  • 温州外贸网站深圳工程建设交易服务中心网站
  • 网站导航网址大全网页设计模板代码免费
  • 卖机械设备什么网站做推广好做机械有什么兼职网站
  • 全屋定制十大公认品牌有哪些seo页面链接优化
  • 电子商务网站建设基础考试十大营销手段
  • 关于做服饰网站的首页WordPress纯代码添加
  • 网站qq交谈怎么做的公司注册50万和100万
  • 网站推广的电子邮件推广使用ftp修改网站图片
  • 建设宣传家乡的网站跨境电商怎么注册
  • 广州天河区网站建设公司wordpress调用文章描述
  • 网站开发项目策划书制作书签怎么做
  • 做网站组织结构框架例子整站seo优化哪家好
  • 网站内存不足哈尔滨网站优化页面
  • 响应式网站 图片尺寸奇数南宁网站建设业务员
  • 咸宁 网站建设wordpress聚合广告平台