spring-security-oauth2

Spring Security OAuth2 check_token endpoint

给你一囗甜甜゛ 提交于 2019-12-03 09:40:27
问题 I'm trying to setup a resource server to work with separate authorization server using spring security oauth. I'm using RemoteTokenServices which requires /check_token endpoint. I could see that /oauth/check_token endpoint is enabled by default when @EnableAuthorizationServer is used. However the endpoint is not accessible by default. Should the following entry be added manually to whitelist this endpoint? http.authorizeRequests().antMatchers("/oauth/check_token").permitAll(); This will make

StackOverflowError in spring oauth2 with custom ClientDetailsService

霸气de小男生 提交于 2019-12-03 09:19:01
问题 I made my own implementation of ClientDetailsService: @Service public class JpaClientDetailsService implements ClientDetailsService { @Autowired private ClientRepository clientRepositoy; @Override public ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException { ClientDetails client = clientRepositoy.findOne(clientId); if (client == null) { throw new ClientRegistrationException(String.format("Client with id %s not found", clientId)); } return client; } }

Implementing authentication and authorization using Zuul Proxy, Oauth2 on REST Microservices

可紊 提交于 2019-12-03 09:00:36
I am trying to implement the above architecture in the workflow with Spring Boot. Web client makes a request to Resource Server (Microservices Endpoints) through Zuul Proxy. Zuul Proxy redirects to oauth2 server for authentication. Oauth2 redirects to Zuul Proxy if the request is authenticated or not. If not authenticated, Zuul redirects Web client with an unauthenticated response. If Authenticated, Zull proxy redirects to the requested microservice endpoint. Microservice endpoint checks if the user is authorized (user level access) to access the resource or not. Microservice also could make

Spring Boot OAuth 2.0 UserDetails user not found

回眸只為那壹抹淺笑 提交于 2019-12-03 07:47:22
I am new to Spring Boot, and I am trying to configure OAuth 2.0. The problem I am having at this moment is that I keep getting the following message when I attempt to request for an access token: { "error": "invalid_grant", "error_description": "Bad credentials" } The error message in the Spring Boot console says that the user cannot be found. : Authentication attempt using org.springframework.security.authentication.dao.DaoAuthenticationProvider : User 'stromero' not found : Returning cached instance of singleton bean 'authenticationAuditListener' I have implemented a custom user that has

Need to create oAuth2 token manually without password

落花浮王杯 提交于 2019-12-03 07:22:46
I have implemented oAuth2 with spring security and it is working fine for me. But Now I want to create user token from back-end manually without password. Because I have only username of user. Can any one help me. Got Answer!!! HashMap<String, String> authorizationParameters = new HashMap<String, String>(); authorizationParameters.put("scope", "read"); authorizationParameters.put("username", "user"); authorizationParameters.put("client_id", "client_id"); authorizationParameters.put("grant", "password"); Set<GrantedAuthority> authorities = new HashSet<GrantedAuthority>(); authorities.add(new

Spring Boot + Spring Security + Spring OAuth2 + Google Sign in

烈酒焚心 提交于 2019-12-03 05:57:18
问题 I have setup a small project to implement OAuth2 Login with Google+ API, using Spring Boot (1.5.2), Spring Security and Spring Security OAuth2. You can find source in: https://github.com/ccoloradoc/OAuth2Sample I am able to authenticate with google and pull out user information. However, after I logout I cannot login again since I got a "400 Bad Request", after I attempt to connect "https://accounts.google.com/o/oauth2/auth" with my RestTemplate to invoke google api. See Filter

How do /oauth/authorize and /oauth/token interact in Spring OAuth?

不打扰是莪最后的温柔 提交于 2019-12-03 05:54:57
I am doing an in-depth study of Spring OAuth, and I found some conflicting information. Can someone please clarify? Specifically, this tutorial states that the /oauth/token endpoint handles the username and password before granting a refresh token to the client app. By contrast, the Spring OAuth Developer Guide mentions the /oauth/authorize and /oauth/token endpoints, but yet does not get specific about how they work. Does the /oauth/authorize do 100% of the username/password/nOtherFactors check and then signal the /oauth/token endpoint to send a refresh token to the client, so that the client

Unable to get EnableOauth2Sso Working — BadCredentialsException: Could not obtain access token

て烟熏妆下的殇ゞ 提交于 2019-12-03 05:39:45
问题 I'm trying to get a simple Spring OAuth2 SSO application working and I've been unable to do so. Here's the steps and results of what's happened: Hit endpoint /user , which is secured by OAuth2 I get forwarded to a simple Spring OAuth2 authorization server I authenticate to the authorization server I approved the access Then I get a white label error page on the OAuth2 SSO application with the following: Whitelabel Error Page This application has no explicit mapping for /error, so you are

PreAuthorize error handling

南笙酒味 提交于 2019-12-03 05:38:15
I'm using Spring Oauth2 and Spring Pre-post Annotations With Spring-boot I Have a service class MyService . one of MyService methods is: @PreAuthorize("#id.equals(authentication.principal.id)") public SomeResponse getExampleResponse(String id){...} can i control in some manner the json that is returned by the caller Controller? the json that is returned by default is: {error : "access_denied" , error_message: ".."} I Want to be able to control the error_message param. I'm looking for something similar to: @PreAuthorize(value ="#id.equals(authentication.principal.id)", onError ="throw new

How to add a client using JDBC for ClientDetailsServiceConfigurer in Spring?

老子叫甜甜 提交于 2019-12-03 04:04:33
问题 I have the in memory thing working as follows: @Override public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("clientapp") .authorizedGrantTypes("password", "refresh_token") .authorities("USER") .scopes("read", "write") .resourceIds(RESOURCE_ID) .secret("123456"); } I would like to use the JDBC implementation. For this, I have created the following tables (using MySQL): -- Tables for OAuth token store CREATE TABLE oauth_client_details