spring-security-oauth2

Spring OAuth Authorization Server Requires Scope

被刻印的时光 ゝ 提交于 2019-12-07 03:54:29
问题 We're currently using the Spring OAuth Authorization Server but currently do not use the "scope" parameter from the OAuth specification. This has been a bit of a pain point as the Spring OAuth Authorization Server requires that scope be explicitly required when requesting an authorization code. From DefaultOAuth2RequestValidator : if (requestScopes.isEmpty()) { throw new InvalidScopeException("Empty scope (either the client or the user is not allowed the requested scopes)"); } This however

Spring Oauth2 - multiple tokens per client id

柔情痞子 提交于 2019-12-07 02:13:29
问题 We have implemented a server API using spring-oauth2. I have noticed that the server generates the same token per user/client id combination even when calling from separate devices. This causes an issue as my clients can run multiple instances: e.g. android and ios apps. I need a way to link the token to a specific instance and not re-use the same token. An example where this is required is for GCM (or push notification) where the API needs to know which instance it is communicating with.

How to re-enable anonymous access to Spring Boot Health endpoint?

匆匆过客 提交于 2019-12-07 00:47:08
问题 Probably I'm doing something wrong here, I just can't figure out what... I have an Oauth2 authentication server and a resource server within the same application. Resource server configuration: @Configuration @EnableResourceServer @EnableGlobalMethodSecurity(prePostEnabled = true) @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER-1) public class ResourceServerConfig extends ResourceServerConfigurerAdapter { public static final String RESOURCE_ID = "resources"; @Override public void configure

spring boot OAuth2 role based authorization

被刻印的时光 ゝ 提交于 2019-12-07 00:39:45
问题 We have a dedicated authorization server extending AuthorizationServerConfigurerAdapter, where we have set authorities overriding void configure(ClientDetailsServiceConfigurer clients) method. @Configuration @EnableAuthorizationServer protected static class OAuth2Config extends AuthorizationServerConfigurerAdapter { @Value('${oauth.clientId}') private String clientId @Value('${oauth.secret:}') private String secret @Value('${oauth.resourceId}') private String resourceId @Autowired @Qualifier(

Java Spring Security: 401 Unauthorized for token OAuth2 end point

安稳与你 提交于 2019-12-06 22:54:26
问题 I have a fairly basic setup in my Spring Boot project. I'm trying to set up OAuth2 to protect my API but I'm running into issues with my /oauth/token end point. Making either a POST or GET request to my /oauth/token end point results in the following response (With a 401 Unauthorized status code): { "timestamp": "2018-09-17T16:46:59.961+0000", "status": 401, "error": "Unauthorized", "message": "Unauthorized", "path": "/oauth/token" } This is my Authorization server configuration. import org

org.springframework.security.oauth2.common.exceptions.InvalidGrantException: Bad credentials

不羁的心 提交于 2019-12-06 21:38:29
I'm developing Spring Boot + Authorization Server + OAuth Resource Server . In this example I can easily query though postman over spring-microservices-oauth-server and get the protected data. I created the client to access the data which postman is doing. But I am getting below error, which doesn't get clear to me. Using Spring Boot v2.1.1.RELEASE and spring-cloud-dependencies version Greenwich.RC2 . Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is error="access_denied", error_description="Access token

How to Secure Oauth 2.0 Client ID and Client Secret

非 Y 不嫁゛ 提交于 2019-12-06 16:21:46
When an Android oauth 2.0 client application has client ID and client Secret hard-coded in it. it is very easy to decompile the application and retrieve the credentials. Then What is the use of providing these credentials to oauth server. It is not recommended to hard-code client_id and client_secret into a native app i.e. to use what is called a "confidential client" in a mobile app scenario exactly because the client_secret cannot be kept a secret. A native app would typically be a "public client" to the Authorization Server i.e. one that does not have a client_secret . Security would come

Spring Boot OAuth2 implicit flow + form login and Request method 'POST' not supported error

烂漫一生 提交于 2019-12-06 15:00:08
In my Spring Boot application I'm trying to configure OAuth2 implicit flow. For this purpose I'm trying to configure custom login form. This is my config: @Configuration public class WebMvcConfig extends WebMvcConfigurerAdapter { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { configurer.enable(); } @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("index"); registry.addViewController("/login").setViewName("login"); } @Override public void addResourceHandlers

Spring OAuth2: support auth and resource access with both SSO and custom auth server

房东的猫 提交于 2019-12-06 14:09:27
I've found similar issue but it's unanswered, so I suppose I'm going to duplicate question a little. I am using Spring OAuth2 to implement separate resource and custom authentification servers. I've already configured interaction with auth server through issuing&validating JWT tokens and everything seems fine. Now I'm trying to add SSO functionality but really stuck with it. I've researched the official Spring examples and attached guide but it is very short worded when it comes to connecting SSO part with custom server authentication. And actually author uses only external provider resource (

Spring Boot 2.0.0.M4 OAuth2 token endpoint throws org.springframework.web.HttpRequestMethodNotSupportedException

不羁的心 提交于 2019-12-06 13:58:34
I'm trying to migrate from Spring Boot 1.5.7 to 2.0.0.M4 Right now I'm unable to properly reconfigure my OAuth2 + JWT configuration on Spring Boot 2.0.0.M4 During startup, I noticed following errors for /oauth/token endpoint ( throws org.springframework.web.HttpRequestMethodNotSupportedException ) in the log: 2017-10-04 09:52:46.841 INFO 11780 --- [ main] .s.o.p.e.FrameworkEndpointHandlerMapping : Mapped "{[/oauth/authorize],methods=[POST],params=[user_oauth_approval]}" onto public org.springframework.web.servlet.View org.springframework.security.oauth2.provider.endpoint.AuthorizationEndpoint