spring-cloud-security | Security concerns for distributed applications | Microservice library
kandi X-RAY | spring-cloud-security Summary
kandi X-RAY | spring-cloud-security Summary
Spring Cloud Security offers a set of primitives for building secure applications and services with minimum fuss. A declarative model which can be heavily configured externally (or centrally) lends itself to the implementation of large systems of co-operating, remote components, usually with a central indentity management service. It is also extremely easy to use in a service platform like Cloud Foundry. Building on Spring Boot and Spring Security OAuth2 we can quickly create systems that implement common patterns like single sign on, token relay and token exchange.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Creates a new header with the specified token
- Acquires an access token using the access token provider
- Gets the access token from the request
- Extracts the token extract id from the context
- Attempt to copy the access token from the security context
spring-cloud-security Key Features
spring-cloud-security Examples and Code Snippets
Community Discussions
Trending Discussions on spring-cloud-security
QUESTION
I was following this guide which mentions that the @EnableAuthorizationServer
is deprecated. But when I created a project with the following dependencies, I am not getting the deprecated messages. Is there something I am missing here.
Depedencies - Output from mvn dependency:tree
ANSWER
Answered 2021-Jan-07 at 14:28Well the correct term is that @EnableAuthorizationServer
is in maintenance mode
which basically means deprecated. As in there will be no added features or updates.
The story goes basically as follows.
During Spring 4 i believe there was a single person that maintained the oauth2 part of spring security. When Spring security 5 was launched the team at pivotal decided to do a major overhaul of spring security and the oauth2 parts. So what they did was to drop Authorisation server support, and instead focus on the Resource server support at first.
Spring announcement of dropping Authorisation server support
You have pulled in spring-cloud-starter-oauth2
which in turn har a peer dependency on spring-security-oauth2-autoconfigure
which in turn pulls in spring-security-oauth2
.
Here Spring clearly states that if you wish to use spring-security-oauth2
they will help you out, but it is in maintenance mode.
The choice to not support it was made because an authorization server is like owning a product. Spring doesn't maintain their own database, or own Ldap server etc. There are plenty of auth servers out there that can be used, okta, curity, github, fb, google, etc, etc.
But Spring has actually reevaluated that choice and decided to start a community developed open source authorisation server
So you have 3 choices:
- use the old, that is in maintenance mode
- use a 3rd party vendor, github, fb, google, okta, curity etc.
- try out the new open source authorisation server
QUESTION
i'm trying to get the war file from Jhipster project project using this command
...ANSWER
Answered 2020-Aug-10 at 13:57To make the answer more visible (valid for jhipster 4.x):
for creating a war that can be deployed in an application server use ./gradlew war
and for an executable war file, which can be executed via java -jar
use ./gradlew bootWar
.
QUESTION
Currently in developer training, I am working on a personal project on spring. I started java 6 months ago, so there is a certain notion that I do not yet master. My trainer does not know spring at all, so he cannot help me. I am also French and there is very little reliable documentation on spring (it is evolving quickly). For example, I followed a French tutorial on microservices, and I used the ribbon and zuul proxy while they are currently in maintenance at spring. I started all over (new project) to recode in reactive webflux
I have several concerning spring starter security or spring cloud security
- Spring cloud config (in connection with gitlab)
- eureka server
- admin server
- gateway
- 2 business microservices
- 2 sub-module (model and repository)
I want all my microservices and the internal microservices (eureka, admin server, configserver) to be secure now. But I do not know how.
I want the microservice that consults config-server to identify themselves, and I also want the microservice gateway to identify itself to make requests to other microservices. Finally I want all my microservices to be protected.
Should we put spring-starter-security in microservice? Should we create a new microservice with spring-cloug-security? Should we create a new spring-cloud-security microservice and add spring-start-security everywhere?
https://cloud.spring.io/spring-cloud-security/2.2.x/reference/html/ Obviously I find this link not very explanatory
Thank you
...ANSWER
Answered 2020-Jul-17 at 14:33In a microservice architecture that I have worked, we have always used the OAUTH2 specification for securing service.
OAuth2 is a token-based security framework that allows a user to authenticate themselves with a third-party authentication server. If the user successfully authenticates, they will be presented with a token that must be sent with every request. The token can then be validated back to the OAuth2 Server. The OAuth2 Server is the intermediary between the application and the services being consumed. The OAuth2 Server allows the user to authenticate themselves without having to pass their user credentials down to every service the application is going to call on behalf of the user.
Detail information for OAuth2 you can find in the following LINK .
I have implemented simple microservice architecture for demonstrating how services are connected with each other.
Here is the link LINK
QUESTION
In Spring Boot with MVC it was possible to get information about Keycloak user realm and defined attributes through injected Principal
in controller method, which was of type KeycloakAuthenticationToken
, which provides this information.
But in Spring Cloud Gateway with dependencies
...ANSWER
Answered 2020-May-22 at 14:37Actually, it works. There is nothing wrong with posted code. I didn't set Keycloak Mappers properly, which is needed to add attributes to token.
With that configured, above method is enough to retrieve user attributes from the token.
They will be in token.getPrincipal().getAttributes()
property of OAuth2AuthenticationToken token
.
QUESTION
In the logs, Zipkin status is coming as true but I can not see it in the Zipkin UI.
...ANSWER
Answered 2019-Oct-09 at 07:18I have a working project with spring cloud stream and zipkin using the following configuration (maybe you should set the sender.type):
QUESTION
I'm trying to create a sample authorization server using the spring security oauth2 framework. The tutorials are confusing compared to any other spring related examples.
Update: If you are looking for a working solution, go to my answer. Ignore the code below.
When I invoked the token issue endpoint, the following error was thrown
...ANSWER
Answered 2019-Jan-11 at 17:52By specification, the token issue endpoint
must be protected.
You have to provide client_id
and client_secret
as parameters (form) or as an http-basic authorization header
Taken directly from spec
QUESTION
This seems like a pretty common question, and has a simple answer however implementing the documented solution isn't working for me.
I have a zuul proxy/gateway for all incoming requests which then forwards those onto different micro services. Each incoming request has a correct bearer token set in the header (this is set and validated in the front end (from okta) and confirmed it works when skipping Zuul and going direct to a service), I just need to pass that onto the micro services.
EdgeServiceApplication
...ANSWER
Answered 2017-Nov-01 at 09:45From the official documentation:
The sensitiveHeaders are a blacklist and the default is not empty, so to make Zuul send all headers (except the "ignored" ones) you would have to explicitly set it to the empty list. This is necessary if you want to pass cookie or authorization headers to your back end.
So the sensitiveHeaders
work the other way around. They prevent headers from being downstreamed to your back-end. Instead of adding Authorization header to the list you should remove it from there like this:
QUESTION
I am currently following this tutorial on how to implement oauth2 Authentication and Authorization with microservices:
http://stytex.de/blog/2016/02/01/spring-cloud-security-with-oauth2/
I have it working as is, but I am having a real hard time trying to figure out how to implement jwt with HS256 rather than the current RSA256 algorithm that's being used.
I think I've narrowed it down to this snippet of code from the authentication server in the Oauth2Configuration class:
...ANSWER
Answered 2017-Mar-15 at 15:03You are configuring your JwtAccessTokenConverter to use a key pair therefore it will use RSA. If you want to setSigningKey it will use HMACSHA256.
Take a look at the code :
QUESTION
I have an oauth-server secured with 'spring-cloud-oauth2' and 'spring-cloud-security' and the application is a spring-boot application. I am trying to get access_token from an angular 2 app, i.e. I want to login from angular 2 app. In my oauth-server I have a client-id=microservice and client-secret=microservicesecret. I have checked the oauth-server from postman where, in the authorization section, for username and password, I use the client-id and client-secret respectively. And in the body section, I use grant_type=password, client_id=microservice, username=m@email.com, password=passw0rd and everything works great.
But, I am having trouble using the configuration in angular 2 app. I have used the following code-snippets.
...ANSWER
Answered 2017-Mar-06 at 21:25Were you tried to get token via Postman or something similar. There are many reason to get HTTP 401. If you post spring auth server log and request details, it would be more clear to understand.
I'm sharing my login function works well via Spring Boot Auth Server. I use Authorization Hedar with Basic BASE64 Token instead of using 'client_id' and 'client_secrete' .
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install spring-cloud-security
Default Checkstyle rules
File header setup
Default suppression rules
Project defaults for Intellij that apply most of Checkstyle rules
Project style conventions for Intellij that apply most of Checkstyle rules
checkstyle.header.file - please point it to the Spring Cloud Build’s, spring-cloud-build-tools/src/main/resources/checkstyle-header.txt file either in your cloned repo or via the https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt URL.
checkstyle.suppressions.file - default suppressions. Please point it to the Spring Cloud Build’s, spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml file either in your cloned repo or via the https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml URL.
checkstyle.additional.suppressions.file - this variable corresponds to suppressions in your local project. E.g. you’re working on spring-cloud-contract. Then point to the project-root/src/checkstyle/checkstyle-suppressions.xml folder. Example for spring-cloud-contract would be: /home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page