spring-security-oauth2

Spring Cloud OAuth2: Resource server with multiple Authorization server

笑着哭i 提交于 2019-12-03 17:02:36
We are developing an application in a microservice architecture, which implements signle sign-on using Spring Cloud OAuth2 on multiple OAuth2 providers like Google and Facebook. We are also developing our own authorization server, and will be integrated on next release. Now, on our microservices, which are resource servers, I would like to know how to handle multiple token-info-uri or user-info-uri to multiple authorization servers (e.g. for Facebook or Google). This type of situation is generally solved by having a middle-man; a single entity that your resource servers trust and that can be

Spring security OAuth2 authentication and form login in one app

丶灬走出姿态 提交于 2019-12-03 16:32:58
Is it possible to combine authoryzation and authentication by login basic and by oauth2 in one application? My project is based on jhipster project with simple spring security session login, now i need add oauth2 security for mobile app and it's look like it is not possible. Now i have situation when work one of them, oauth2 ok if WebSecurityConfigurerAdapter had bigger order number than ResourceServerConfiguration. That's mean if oauth security filter is first. I read a lot in stackoverflow and try many solution like: Spring security oauth2 and form login configuration for me thats one don't

Is there working example of OAuth2 with WebFlux

坚强是说给别人听的谎言 提交于 2019-12-03 15:46:20
问题 I'm trying to add OAuth2 to WebFlux and can't find any working example. To Implement own Authorization Server I use such code: @EnableAuthorizationServer @Configuration public class ServerAuth extends AuthorizationServerConfigurerAdapter { ... } And my spring boot application stops working because inside AuthorizationServerConfigurerAdapter class there's usage of AuthorizationServerSecurityConfigurer which depends of javax.servlet.Filter but in the WebFlux application, there're no Servlet

PreAuthorize error handling

好久不见. 提交于 2019-12-03 14:57:08
问题 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

Authorization header not passed by ZuulProxy starting with Brixton.RC1

假如想象 提交于 2019-12-03 14:21:21
In switching from Spring Cloud Brixton.M5 to Brixton.RC1 my ZuulProxy no longer passes Authorization headers downstream to my proxied services. There's various actors in play in my setup, but most all of them are fairly simple: - AuthorizationServer: runs separately; hands out JWTs to clients - Clients: get JWTs from OAuth server; each with access to a subset of resources. - ResourceServers: consume JWTs for access decisions - MyZuulProxy: proxies various resource servers; should relay JWTs. It should be noted that MyZuulProxy has no security dependencies whatsoever; It passed the

Add custom UserDetailsService to Spring Security OAuth2 app

霸气de小男生 提交于 2019-12-03 13:52:53
How do I add the custom UserDetailsService below to this Spring OAuth2 sample ? The default user with default password is defined in the application.properties file of the authserver app. However, I would like to add the following custom UserDetailsService to the demo package of the authserver app for testing purposes: package demo; import java.util.List; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core

Does OAuth2 allow for authorization using non-password or custom credentials?

橙三吉。 提交于 2019-12-03 13:17:24
I'm using Spring Security OAuth2. The client application (that we own) makes a "password" grant request that passes the user's username and password. Just like the draft specifies. I need this mechanism to also support other types of credentials, like card number, PIN, and even a pre-authenticated, password not required grant. Please keep in mind, these requests will only be permitted by a privileged client_id, one that will only be used from the application we own. Dave, thanks for the quick response. I actually found the perfect solution, one which you took part in. It has to do with "custom

How to use RemoteTokenService?

霸气de小男生 提交于 2019-12-03 12:55:49
问题 I have a separate ResourceServer built using Spring-Security-oauth2. Here is the code RemoteTokenService. @Bean public ResourceServerTokenServices tokenService() { RemoteTokenServices tokenServices = new RemoteTokenServices(); tokenServices.setClientId("sample_test_client_app"); tokenServices.setClientSecret("secret"); tokenServices.setCheckTokenEndpointUrl("http://localhost:8080/oauth/check_token"); return tokenServices; } When I'm accessing the resource server with AccessToken I get the

OAuth2 SSO for multiple resource servers with spring boot and jHipster

為{幸葍}努か 提交于 2019-12-03 12:53:24
问题 So, I have an oAuth2 app which is jHipster app (using mongodb). I want to connect 3 resource apps to that app but all of them should share the same user base, so that the users should be able to login only once. Is there a way to configure multiple resources in Spring Boot with jHipster so that it won't be as a separate client that would need username and password before accessing the resource? And also how can I specify user role for each resource server? All of the app are based on spring

CSRF issue with Spring + Angular 2 + Oauth2 + CORS

谁都会走 提交于 2019-12-03 11:39:32
I am developing a client-server application based on Spring 4.3 and Angular (TypeScript) 4.3, in a CORS scenario where, in production, server and client are on different domains. Client ask for REST server APIs via http requests. 1. REST AND OAUTH CONFIGURATION: The server exposes REST APIs: @RestController @RequestMapping("/my-api") public class MyRestController{ @RequestMapping(value = "/test", method = RequestMethod.POST) public ResponseEntity<Boolean> test() { return new ResponseEntity<Boolean>(true, HttpStatus.OK); } } Protected by Oauth2 as explained on spring documentation. Obviously I