Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Spring Microservices

You're reading from   Spring Microservices Internet-scale architecture with Spring framework, Spring Cloud, Spring Boot

Arrow left icon
Product type Paperback
Published in Jun 2016
Publisher Packt
ISBN-13 9781786466686
Length 436 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Rajesh R V Rajesh R V
Author Profile Icon Rajesh R V
Rajesh R V
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Demystifying Microservices 2. Building Microservices with Spring Boot FREE CHAPTER 3. Applying Microservices Concepts 4. Microservices Evolution – A Case Study 5. Scaling Microservices with Spring Cloud 6. Autoscaling Microservices 7. Logging and Monitoring Microservices 8. Containerizing Microservices with Docker 9. Managing Dockerized Microservices with Mesos and Marathon 10. The Microservices Development Life Cycle Index

Implementing Spring Boot security


It is important to secure microservices. In this section, some basic measures to secure Spring Boot microservices will be reviewed using chapter2.bootrest to demonstrate the security features.

Securing microservices with basic security

Adding basic authentication to Spring Boot is pretty simple. Add the following dependency to pom.xml. This will include the necessary Spring security library files:

<dependency>
  <groupId>org.springframework.boot</groupId> 
  <artifactId>spring-boot-starter-security</artifactId>
</dependency>

Open Application.java and add @EnableGlobalMethodSecurity to the Application class. This annotation will enable method-level security:

@EnableGlobalMethodSecurity
@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

The default basic authentication assumes the user as being user. The default password...

You have been reading a chapter from
Spring Microservices
Published in: Jun 2016
Publisher: Packt
ISBN-13: 9781786466686
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image