spring-security

Referenced bean 'org.springframework.security.securityContextSource' not found

混江龙づ霸主 提交于 2019-12-25 03:36:23
问题 I am configuring spring security ldap. But in spring-security.xml, m getting this warning Referenced bean 'org.springframework.security.securityContextSource' not found on <security:authentication-manager> line Can anyone tell me, what can be the problem??? 回答1: Please ensure you have in dependencies spring-ldap-core. Example for 3.1.3 <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-ldap</artifactId> <version>3.1.3.RELEASE</version> </dependency> 回答2:

spring_security_last_username

China☆狼群 提交于 2019-12-25 03:34:49
问题 Can we access "spring_security_last_username" form the Controller instead of jsp? 回答1: SPRING_SECURITY_LAST_USERNAME is a session attribute, therefore you can access it from the controller like any session attribute: public ModelAndView controller(..., Session s) { String lastUsername = s.getAttribute("SPRING_SECURITY_LAST_USERNAME"); ... } 回答2: I just want to add that the SPRING_SECURITY_LAST_USERNAME_KEY is deprecated. As mentioned in its deprecation note, you should use your custom

Spring Security AspectJMode with @EnableGlobalMethodSecurity not working

蓝咒 提交于 2019-12-25 03:27:28
问题 I am trying to move from XML Config to JavaConfig with spring-security 4.0.0.M1 This is my Configuration which works: @Configuration @ImportResource("classpath:applicationContext-security.xml") public class MethodSecurityXmlConfig {} and applicationContext-security.xml <?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi

Spring Oauth password grant with FB login

狂风中的少年 提交于 2019-12-25 03:26:42
问题 I've a Spring backend with Spring OAuth2 and Angularjs client. Plain username/password password grant is no brainer. But what happens when I want the user also to be able to login with another oauth provider such as FB. I imagine the following flow: First retrieve FB access token from the angular client. Post that token somehow as a password grant request to the spring endpoint From backend fetch userId using the token from FB. Find user with same fb userId. If found create securityContext

PrincipalExtractor and AuthoritiesExtractor doesn't hit

ぃ、小莉子 提交于 2019-12-25 03:22:55
问题 I have a project with Spring security and Oauth2. On the resource server I have the following configuration: @Configuration public class SecurityConfiguration extends ResourceServerConfigurerAdapter { @Override public void configure(final HttpSecurity http) throws Exception { http.antMatcher("/**") .authorizeRequests().antMatchers("/info", "/health", "/h2-console/**").permitAll() .anyRequest().authenticated() .and().headers().frameOptions().disable(); } } I have the following extractors:

How do I merge these two Spring Boot controllers?

不打扰是莪最后的温柔 提交于 2019-12-25 03:12:28
问题 How do I merge the two controllers below with different annotations into one controller? I am trying to set up a Spring Boot app that uses AngularJS on the front end with MySQL-based Spring Security authentication on the back end. Towards this end, I have been studying the code in this example which links AngularJS with Spring Boot Security and authentication from server-side config and from this other example, which uses MySQL-based authentication to a Spring Boot backend of an app that uses

Authenticating users with Spring security against two user-services

时光总嘲笑我的痴心妄想 提交于 2019-12-25 02:58:44
问题 I am very new to Spring security and my problem is as follows: I have a member mysql table that contains information about the website's members, including their usernames, passwords and roles. So far so good: I can use this table to configure a <jdbc-user-service . However I also want to have a super user that is not going to be in the member table. Is it possible and recommended to have this super-user in an in-memory user repository and therefore mix jdbc user service with in-memory user

Security configuration on Spring Boot 2.1 - How to keep the default instead of my custom for tests?

荒凉一梦 提交于 2019-12-25 02:45:06
问题 I recently updated from Spring Boot 2.0.4 to 2.1.2 but due to the WebMvcTest auto-inclusion of custom security configurations my custom security configuration is being included. The problem with that is that my custom security configuration depends on other components (services and repositories down the dependency tree), and I don’t want to set up the entire infrastructure. How can I set up the same behavior of 2.0.4, but with the new Micrometers of this version? 来源: https://stackoverflow.com

How to set role in MockHttpServletRequest?

为君一笑 提交于 2019-12-25 02:44:46
问题 I have read following topic: https://stackoverflow.com/a/18487953/2674303 But it is a bit not my variant. Inside my method controller which I need to test I have following line: httpServletRequest.isUserInRole("ROLE_OWNER"); How can I set role in MockHttpServletRequest ? 回答1: mockMvc.perform(post("/owner/terminals/edit").principal(principal).with(new RequestPostProcessor() { public MockHttpServletRequest postProcessRequest(MockHttpServletRequest request) { request.addUserRole("ROLE_OWNER");

How Struts 2 will behave with Spring integration

谁说我不能喝 提交于 2019-12-25 02:41:38
问题 Usually Struts 2 action instances will get create on the request. I mean per every request new action instance will get create. But if I integrate with Spring then there will be only one action instance will get create (I am not sure correct me if I am wrong). So in this case what is if I have instance variables in the action class? First user here will set that instance with some instance variables and second user may set there something. How it will behave at this time? More clarification: