草庐IT

Figma$DJI$Security

全部标签

security - Spring 安全盐

我在添加新用户/密码时尝试添加盐,但文档似乎缺少如何执行此操作。这是一个基本的例子:您可以通过示例看到没有使用自定义盐或自定义密码编码器。那么,在添加新用户/密码时,我将如何连接Salt?我认为它会是这样的:@AutowiredSaltSourcesaltSource;protectedvoidfoo(finalCustomUseruser){finalPasswordEncoderencoder=newMd5PasswordEncoder();user.setPassword(encoder.encodePassword(user.getPassword(),saltSource))

java - Spring Security 为所有角色名称添加了前缀 "ROLE_"?

我的网络安全配置中有此代码:@Overrideprotectedvoidconfigure(HttpSecurityhttp)throwsException{http.authorizeRequests().antMatchers("/api/**").hasRole("ADMIN").and().httpBasic().and().csrf().disable();}所以我在我的数据库中添加了一个具有“ADMIN”角色的用户,当我尝试使用该用户登录时,我总是得到403错误,然后我启用了spring日志,我发现了这一行:2015-10-1823:13:24.112DEBUG4899--

spring - 无法在 Spring Security 中验证 url 模式的角色

我正在使用springsecurity3.1.7.RELEASE和spring3.2.13.RELEASE。我的spring-security.xml中有如下条目:当我尝试点击url/siteadmin/cleancache.htm时出现以下异常:java.lang.IllegalArgumentException:Failedtoevaluateexpression'ROLE_ADMIN'org.springframework.security.access.expression.ExpressionUtils.evaluateAsBoolean(ExpressionUtils.ja

java - 以编程方式启用 Spring Security pre-post-annotations

我有SpringWebMVC应用程序,在Controller方法上使用@PreAuthorize和@PostAuthorice注释。但是这些注释被忽略了,因为我没有在我的SpringSecurity中启用它。如果我有一个spring-security.xml我可以使用以下行启用它:不幸的是,我有一个完整的基于注释的配置。Spring-Security原则上适用于我的应用程序。我的问题:如何使用基于注释的MVC配置启用pre-post-annotation?Spring版本:4.0.5.RELEASESpring-Security-版本:3.2.4.RELEASE这是我的WebSecur

Spring Security 在安全注释配置中排除 url 模式

我有使用javaconfig方法配置Spring安全性的SpringWeb应用程序。我想从身份验证中排除一些URL模式(例如:静态资源等)。我之前已经使用springsecurityxmlconfig完成了此操作,但无法通过javaconfig弄清楚,因为添加antmatchers没有帮助。以下是我在扩展WebSecurityConfigurerAdapter的安全配置类中添加的代码@Overridepublicvoidconfigure(HttpSecurityhttp)throwsException{http.authorizeRequests().antMatchers("/au

java - Spring security PreAuthentication Filter 要求 AuthenticationEntryPoint

我正在尝试将PreAuthFilter(用于Siteminder)与SpringSecurity3.0一起使用。-->以上配置失败org.springframework.beans.factory.parsing.BeanDefinitionParsingException:Configurationproblem:NoAuthenticationEntryPointcouldbeestablished.Pleasemakesureyouhavealoginmechanismconfiguredthroughthenamespace(suchasform-login)orspecify

spring - Maven : Spring 4 + Spring Security

您能向我解释一下如何使用Spring正确构建Web应用程序吗?我知道Spring框架的最新版本是4.0.0.RELEASE,但是SpringSecurity的最新版本是3.2.0.RELEASE,而且它依赖于spring3.2.6......也许我错了:)如何将它与Maven集成?我可以使用Spring4还是必须使用以前的版本?正确的方法是什么?如果对你来说不难,你能给我看看你的pom.xml吗? 最佳答案 使用Spring4应该没问题。如documentation中所述。:"SpringSecurity针对SpringFramew

java - 具有可变 URL 用户 ID 的 antMatchers Spring Security 模式

我一直在寻找答案,但找不到任何有效的方法在我的休息服务中,我在/account/{id}/download下保留了一些功能,并且我想在SecurityConfigjava文件中设置访问角色,只有ROLE_TOKENSAVED用户才能访问此网址当{id}可变时,模式应该是什么样子?我尝试了一些正则表达式模式,但没有达到我想要的效果,以下是我的一些尝试:1.antMatchers("account/**/download").access(somerolehere)2.antMatchers("account/\\d/download").access(somerolehere)3.ant

Spring Security 3.2 CSRF 对多部分请求的支持

几年来,我们一直在我们的应用程序中使用SpringSecurity。上周我们将SpringSecurity从版本3.1.4升级到了3.2.0。升级很顺利,升级后我们没有发现任何错误。在查看SpringSecurity3.2.0文档时,我们发现了围绕CSRF保护和安全header的新增功能。我们按照SpringSecurity3.2.0文档中的说明为我们protected资源启用CSRF保护。它适用于常规表单,但不适用于我们应用程序中的多部分表单。在提交表单时,CsrfFilter会抛出拒绝访问错误,理由是请求中没有CSRFtoken(通过调试日志确定)。我们已经尝试使用SpringSe

security - 在父上下文与子上下文中声明 Spring Bean

我有一个springbean(dao)对象,我通过以下xml在我的ServletContext中实例化它:这个bean在我的webapp-servlet.xml文件中声明,并被我的应用程序在ServletContext中使用。我也在使用SpringSecurity。我的理解是它在不同的上下文(SecurityContext)中运行。我的应用程序有一个webapp-security.xml,我在其中实例化了一个自定义身份验证提供程序。我想使用我的应用程序中使用的dao来在我的安全上下文中进行用户查找,但是当我运行时:我收到错误消息,说没有这样的bean“userDao”。bean在我的其