草庐IT

Figma$DJI$Security

全部标签

java - Spring Security 总是返回 HTTP 403

我已经配置了一个自定义Filter,它为/login以外的每个URL授予spring权限:publicclassTokenFilterimplementsFilter{@OverridepublicvoiddoFilter(ServletRequestreq,ServletResponseres,FilterChainchain)throwsIOException,ServletException{GrantedAuthorityauthority=newSimpleGrantedAuthority("myAuthority");UsernamePasswordAuthenticati

java - Spring Security + MVC : same @RequestMapping, 不同@Secured

假设我们有一个使用SpringMVC和SpringSecurity配置的API端点。我们希望能够处理一对@RequestMapping和@Secured注释,其中唯一的@Secured注释值因对而不同。这样,我们就可以根据相同请求的安全规则返回不同的响应正文。通过避免将安全规则直接检查到方法主体中,这可能使我们的代码更易于维护。有一个不工作的例子,这是我们想做的:@Controller@RequestMapping("/api")publicclassController{@Secured({"ROLE_A"})@RequestMapping(value="{uid}",method=

java - Spring Security + MVC : same @RequestMapping, 不同@Secured

假设我们有一个使用SpringMVC和SpringSecurity配置的API端点。我们希望能够处理一对@RequestMapping和@Secured注释,其中唯一的@Secured注释值因对而不同。这样,我们就可以根据相同请求的安全规则返回不同的响应正文。通过避免将安全规则直接检查到方法主体中,这可能使我们的代码更易于维护。有一个不工作的例子,这是我们想做的:@Controller@RequestMapping("/api")publicclassController{@Secured({"ROLE_A"})@RequestMapping(value="{uid}",method=

java - 如何仅针对特定 url 额外添加 Spring Security 验证码过滤器

我正在寻找一种非侵入性的方式来为某些api调用添加验证码过滤器。我的设置由两个WebSecurityConfigurerAdapters组成,每个都有一个过滤器(不是验证码过滤器):内部api(“/iapi”在所有调用中使用过滤器A,但也会忽略一些public请求,例如/authenticate)外部api(“/eapi”在所有调用中使用过滤器B)如何在公共(public)、内部api或外部api调用中添加过滤器之前SpringSecurity的东西?我不需要SecurityContext,只需要检查请求header中的验证码,转发到filterChain(普通过滤器)或手动拒绝访问。

java - 如何仅针对特定 url 额外添加 Spring Security 验证码过滤器

我正在寻找一种非侵入性的方式来为某些api调用添加验证码过滤器。我的设置由两个WebSecurityConfigurerAdapters组成,每个都有一个过滤器(不是验证码过滤器):内部api(“/iapi”在所有调用中使用过滤器A,但也会忽略一些public请求,例如/authenticate)外部api(“/eapi”在所有调用中使用过滤器B)如何在公共(public)、内部api或外部api调用中添加过滤器之前SpringSecurity的东西?我不需要SecurityContext,只需要检查请求header中的验证码,转发到filterChain(普通过滤器)或手动拒绝访问。

java - Spring Security、Spring MVC 和登录 session

按照Spring自己的引用应用程序“petclinic”的建议,我的SpringMVC和SpringSecurity已启动并运行。一切都很好,除了登录不坚持浏览器重启。必须考虑哪些因素才能确保已登录的用户在浏览器重启后无需重新登录? 最佳答案 在浏览器重新启动时,不会维护用户session。因此,您的登录信息不会在浏览器重启后继续存在,因为它们存储在session中。要设置在浏览器重新启动后仍然存在的登录,您需要实现基于cookie的身份验证,在Spring安全性中也称为“记住我”。要使用Spring安全设置“记住我”,我建议您th

java - Spring Security、Spring MVC 和登录 session

按照Spring自己的引用应用程序“petclinic”的建议,我的SpringMVC和SpringSecurity已启动并运行。一切都很好,除了登录不坚持浏览器重启。必须考虑哪些因素才能确保已登录的用户在浏览器重启后无需重新登录? 最佳答案 在浏览器重新启动时,不会维护用户session。因此,您的登录信息不会在浏览器重启后继续存在,因为它们存储在session中。要设置在浏览器重新启动后仍然存在的登录,您需要实现基于cookie的身份验证,在Spring安全性中也称为“记住我”。要使用Spring安全设置“记住我”,我建议您th

spring - Spring Security中Realm是什么意思

在我的应用程序中,我使用了springsecurity,我只想知道HTTPconfig中的“realm”是什么意思。 最佳答案 领域是一种凭据存储,可启用基于身份或角色的访问控制。JavaDocumentationWhatisarealm?Forawebapplication,arealmisacompletedatabaseofusersandgroupsthatidentifyvalidusersofawebapplication(orasetofwebapplications)andarecontrolledbythesame

spring - Spring Security中Realm是什么意思

在我的应用程序中,我使用了springsecurity,我只想知道HTTPconfig中的“realm”是什么意思。 最佳答案 领域是一种凭据存储,可启用基于身份或角色的访问控制。JavaDocumentationWhatisarealm?Forawebapplication,arealmisacompletedatabaseofusersandgroupsthatidentifyvalidusersofawebapplication(orasetofwebapplications)andarecontrolledbythesame

java - Spring Security 和 LDAP 身份验证

我正在尝试设置LDAP身份验证,这是我的spring-security.xml文件:根据spring安全文档,这应该可以工作,但它不会,相反,它会抛出这个异常:2012-01-2423:05:35,843ERRORorg.springframework.web.context.ContextLoader-Contextinitializationfailedorg.springframework.context.ApplicationContextException:NoBaseLdapPathContextSourceinstancesfound.Haveyouaddedanelem