spring-security-oauth2

Spring Security: deserialize request body twice (oauth2 processing)

99封情书 提交于 2019-12-24 07:07:44
问题 This question is a result of some work I'm doing with the Spring Security Oauth2 library. I've set up an oauth2 authorization server and an oauth2 resource server, the latter of which is meant to authorize based on access tokens. The problem is that normally access tokens are passed in a header, but the big client we're setting this up for wants to pass the access token in a JSON request body. There's an interface you can use to set up custom access token extraction, but it looks like this:

Spring Security OAuth 2.0 with no client_secret

我只是一个虾纸丫 提交于 2019-12-24 05:15:15
问题 I am developing a login system for my Android application using Spring Boot and Spring Security OAuth 2.0. My starting point is the following demo repository: https://github.com/royclarkson/spring-rest-service-oauth. In the demo you can find the following setup: OAuth2 client: clients .inMemory() .withClient("clientapp") .authorizedGrantTypes("password", "refresh_token") .authorities("USER") .scopes("read", "write") .resourceIds(RESOURCE_ID) .secret("123456"); Method to fetch the access token

Error creating bean with name 'resourceHandlerMapping' defined in class path resource [EnableWebMvcConfiguration.class]

三世轮回 提交于 2019-12-24 00:36:07
问题 I am trying to create a rest oauth secured service using spring boot 2.0.0.M4. I am keep getting below exception. I read couple of posts related to error in creating bean with name [...] but nothing worked out.I am posting here my pom.xml along with code. Please guide me if anything clicks to anybody. POM.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache

Angular HttpClient doesn't send POST, it sends OPTIONS

情到浓时终转凉″ 提交于 2019-12-23 17:57:39
问题 Im' newbie using Angular HttpClient (and writting english too) I have a problem, I'm trying sending HTTP request with POST method in order to negociate OAuth token obtenction but angular sends OPTIONS request: Service: login(username: string, password: string) { const body = `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}&grant_type=password`; const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization

An Authentication object was not found in the SecurityContext in oauth2

旧时模样 提交于 2019-12-23 16:53:09
问题 I have a project which uses spring security oauth2 for secured connections.Below is my spring configuration file. spring-security.xml : <?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oauth="http://www.springframework.org/schema/security/oauth2" xmlns:sec="http://www.springframework.org/schema/security" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http:/

Refresh token call fails using spring security an oauth2 with error: UserDetailsService is required

被刻印的时光 ゝ 提交于 2019-12-23 10:15:15
问题 I am using Spring Security OAuth2 for authorizations. When trying to refresh the token I get an error: UserDetailsService is required (interestingly I get this error only on unix machines and not on windows). I am using Spring OAuth2 version 2.0.7. For some reason the AuthenticationManager in the DefaultTokenService is not empty and it tries to authenticate the user to check if he still exists. I think it gets initialized because of some spring security vs. spring oauth2 configuration

Cannot instantiate interface org.springframework.context.ApplicationListener after adding spring-security-oauth2

久未见 提交于 2019-12-23 08:54:59
问题 After I added spring-security-oauth2 to my pom.xml: <dependency> <groupId>org.springframework.security.oauth</groupId> <artifactId>spring-security-oauth2</artifactId> <version>2.2.0.RELEASE</version> </dependency> I started to get Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationListener : org.springframework.boot.context.logging.ClasspathLoggingApplicationListener at org.springframework.boot.SpringApplication

How to generate Client Secret in OAuth2 Authentication using Spring

不羁的心 提交于 2019-12-23 05:24:02
问题 I am working on creating api for OAuth2 using Spring for my application but there is nothing written in the specification (http://tools.ietf.org/html/rfc6749) nor in Spring OAuth2 Documentation about how to generate client secret. Do anyone have any idea? 回答1: Spring uses PasswordEncoder for decoding/encoding clients secrets. See the JdbcClientDetailsService (if you're planning to store client details in DB). So when configuring beans for Spring OAuth2 you typically provide an instance of

Modifying the OAuth2ClientAuthenticationProcessingFilter in Spring Boot

北战南征 提交于 2019-12-23 05:22:09
问题 I'd like to modify the OAuth2ClientAuthenticationProcessingFilter which is created by the @EnableOAuth2Sso configuration in Spring Boot 1.3.2. As far as I can tell, the OAuth2ClientAuthenticationProcessingFilter class is constructed internally without any application context wiring. Is there a way to do this? 回答1: Not sure this is the best way of doing it, but you can do this with a BeanPostProcessor: public static class DefaultRolesPrefixPostProcessor implements BeanPostProcessor,

how oauth token based and session based authorization works together in spring?

不羁的心 提交于 2019-12-23 05:01:59
问题 I was trying to integrate oauth2 based token having client credential grant type with spring session based authentication. It's working fine with oauth token and the authorities given. It's not working when I have combined them both. It always calls UsernamePasswordAuthenticationFilter and not OAuth2AuthenticationProcessingFilter How to make them work together? Here is my ResourceServer configuration @Configuration @EnableResourceServer protected static class ResourceServerConfiguration