草庐IT

Figma$DJI$Security

全部标签

java - Spring Security 3 - 总是返回错误 302

我使用Spring4创建一个简单的应用程序。最近,我将SpringSecurity3添加到项目中,但总是得到错误代码302(所以它总是重定向到home页面)。这是我的SecurityConfig:@Configuration@EnableWebMvcSecurity@ComponentScan(basePackages={"com.moon.repository"})publicclassSecurityConfigextendsWebSecurityConfigurerAdapter{@Overrideprotectedvoidconfigure(AuthenticationMana

spring - 如何在运行时将新用户添加到 Spring Security

我通过Hibernate将用户保存在数据库表中,并且我正在使用SpringSecurity进行身份验证:importorg.springframework.beans.factory.annotation.Autowired;importorg.springframework.context.annotation.*;importorg.springframework.security.config.annotation.authentication.builders.*;importorg.springframework.security.config.annotation.web.

spring - 如何在运行时将新用户添加到 Spring Security

我通过Hibernate将用户保存在数据库表中,并且我正在使用SpringSecurity进行身份验证:importorg.springframework.beans.factory.annotation.Autowired;importorg.springframework.context.annotation.*;importorg.springframework.security.config.annotation.authentication.builders.*;importorg.springframework.security.config.annotation.web.

java - 从 Android 调用使​​用 Spring Security 保护的 REST Web 服务

我使用SpringSecurity在Grails应用程序中托管RESTWeb服务,即:@Secured(['IS_AUTHENTICATED_REMEMBERED'])defsave={println"SaveRideRESTWebMethodcalled"}我从Android应用程序调用它。(调用不安全的服务就可以了。)为了调用服务,我手动构建了一个请求(HttpUriRequest)并使用HttpClient执行它。我想知道最佳实践是什么,以及如何实现它们...具体来说,我应该:执行一次登录,检索JSESSION_ID,然后将包含它的header添加到每个后续请求的HttpUriR

java - 从 Android 调用使​​用 Spring Security 保护的 REST Web 服务

我使用SpringSecurity在Grails应用程序中托管RESTWeb服务,即:@Secured(['IS_AUTHENTICATED_REMEMBERED'])defsave={println"SaveRideRESTWebMethodcalled"}我从Android应用程序调用它。(调用不安全的服务就可以了。)为了调用服务,我手动构建了一个请求(HttpUriRequest)并使用HttpClient执行它。我想知道最佳实践是什么,以及如何实现它们...具体来说,我应该:执行一次登录,检索JSESSION_ID,然后将包含它的header添加到每个后续请求的HttpUriR

spring - 微服务和 Spring Security OAuth2

我已经在另一个项目中运行了OAuth2授权服务器。现在我需要使用OAuth2保护几个简单的spring-boot休息服务器。但我正在寻找Springdocumentation在分离授权和资源服务器方面确实非常有限。我还发现了几个问题theanswer一直是“只要它们共享相同的tokenStore数据源,它们就可以是不同的盒子”。这真的是真的吗?这怎么可能适用于微服务?每个REST服务都需要实现自己的OAuth授权服务器,这似乎是一件非常奇怪的事情。那么,如何为引用远程oauth授权服务器(甚至可能不是用Spring编写)的spring-bootrest-endpoints设置Oauth

spring - 微服务和 Spring Security OAuth2

我已经在另一个项目中运行了OAuth2授权服务器。现在我需要使用OAuth2保护几个简单的spring-boot休息服务器。但我正在寻找Springdocumentation在分离授权和资源服务器方面确实非常有限。我还发现了几个问题theanswer一直是“只要它们共享相同的tokenStore数据源,它们就可以是不同的盒子”。这真的是真的吗?这怎么可能适用于微服务?每个REST服务都需要实现自己的OAuth授权服务器,这似乎是一件非常奇怪的事情。那么,如何为引用远程oauth授权服务器(甚至可能不是用Spring编写)的spring-bootrest-endpoints设置Oauth

spring - Spring Security 从 3.2.7 更新到 4.0.2.RELEASE 如何处理 defaultRolePrefix ="ROLE_"

我的SpringBoot应用程序在SpringSecurity3.2.7.RELEASE上运行。现在,我想将其更新为4.0.2.RELEASE。经过数小时的调试,我发现SpringSecurity4.0.2.RELEASE使用defaultRolePrefix="ROLE_"在org.springframework.security.access.expression.SecurityExpressionRoot.hasAnyAuthorityName(Stringprefix,String...roles)方法在我的应用程序中,我使用不带此前缀的角色,因此我得到AccessDenie

spring - Spring Security 从 3.2.7 更新到 4.0.2.RELEASE 如何处理 defaultRolePrefix ="ROLE_"

我的SpringBoot应用程序在SpringSecurity3.2.7.RELEASE上运行。现在,我想将其更新为4.0.2.RELEASE。经过数小时的调试,我发现SpringSecurity4.0.2.RELEASE使用defaultRolePrefix="ROLE_"在org.springframework.security.access.expression.SecurityExpressionRoot.hasAnyAuthorityName(Stringprefix,String...roles)方法在我的应用程序中,我使用不带此前缀的角色,因此我得到AccessDenie

spring - 如何在 Spring Security 中处理 AccessDeniedException?

我正在使用springsecurity3,我希望每当抛出AccessDeniedException时,用户都会被重定向到特定页面:org.springframework.security.access.AccessDeniedException:Accessisdeniedatorg.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:71)atorg.springframework.security.access.intercept.AbstractSecurityInt