DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • Authentication With Remote LDAP Server in Spring WebFlux
  • Authentication With Remote LDAP Server in Spring Web MVC
  • How to Implement Two-Factor Authentication in A Spring Boot OAuth Server? Part 2: Under the Hood
  • How to Implement Two-Factor Authentication in a Spring Boot OAuth Server? Part 1: Configuration

Trending

  • 5 Subtle Indicators Your Development Environment Is Under Siege
  • Event-Driven Architectures: Designing Scalable and Resilient Cloud Solutions
  • Chat With Your Knowledge Base: A Hands-On Java and LangChain4j Guide
  • Debugging With Confidence in the Age of Observability-First Systems
  1. DZone
  2. Coding
  3. Frameworks
  4. Spring Boot Admin Client Configuration Using Basic HTTP Authentication

Spring Boot Admin Client Configuration Using Basic HTTP Authentication

Learn how to use Spring Boot Admin to set up HTTP authentication for microservices.

By 
Aritra Nag user avatar
Aritra Nag
·
Updated Nov. 14, 18 · Tutorial
Likes (6)
Comment
Save
Tweet
Share
34.1K Views

Join the DZone community and get the full member experience.

Join For Free

Spring Boot Admin Application can be used to manage and monitor our applications.

Client applications register with our Spring Boot Admin Client (via HTTP) or are discovered using Spring Cloud (e.g. Eureka, Consul). The UI is just an AngularJS application on top of the Spring Boot Actuator endpoints.

Multiple boot applications, all registering to same boot admin server, have secured management endpoints with different authentication credentials (a different username/password for each application).

The boot admin UI pops up the window to enter the credentials for each application. This way, we can pass the authentication credentials from the client so that the admin server automatically reads it and connects to secure endpoints.

The solution below helps to take care of the problem above:

Image title

We can monitor the metrics of each of the deployed instances of the microservices. This solution provides the following features for the registered application:

  • Show health status
  • Show details like
    • JVM & memory metrics
    • micrometer.io metrics
    • Datasource metrics
    • Cache metrics
  • Show build-info number
  • Follow and download logfile
  • View JVM system & environment properties
  • View Spring Boot Configuration Properties
  • Support for Spring Cloud’s postable /env- &/refresh-endpoint
  • Easy log level management
  • Interact with JMX-beans
  • View thread dump
  • View http-traces
  • View audit events
  • View http-endpoints
  • View scheduled tasks
  • View and delete active sessions (using spring-session)
  • View Flyway/Liquibase database migrations
  • Download heap dump
  • Notification on status change (via e-mail, Slack, Hipchat, …)
  • Event journal of status changes (non-persistent)

Set Up Server and Client Configuration

Server Setup

  1. Add Spring Boot Admin Server starter to your dependencies:pom.xml
    <dependencies>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
            <version>1.5.7</version>
        </dependency>
    </dependencies>
  2. Pull in the Spring Boot Admin Server configuration via adding @EnableAdminServerto your configuration:
    @Configuration
    @EnableAutoConfiguration
    @EnableAdminServer
    public class SpringBootAdminApplication {
        public static void main(String[] args) {
            SpringApplication.run(SpringBootAdminApplication.class, args);
        }
    }

Application Properties

spring.application.name=Boot-Admin
server.port=8080
security.user.name=admin
security.user.password=admin


Login Page is authenticated with username and password as admin

Client Setup

  1. Add spring-boot-admin-starter-client to your dependencies:pom.xml
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-starter-client</artifactId>
        <version>1.5.7</version>
    </dependency>
  2. Enable the SBA Client by configuring the URL of the Spring Boot Admin Server:application.yml
    spring.boot.admin.url: http://localhost:8080 
    management.security.enabled: false 

Application Properties

We can monitor the memory metrics of the containers and can modify the performance based on the metrics.

server.port=8082
management.context-path=/mgmt
spring.boot.admin.url=http://localhost:8093
spring.application.name=resource-server

security.user.name=admin
security.user.password=admin
logging.level.org.springframework.security: DEBUG

security.basic.enabled=false
management.security.enabled=true

zuul.sensitive-headers=

spring.boot.admin.client.metadata.user.name = admin
spring.boot.admin.client.metadata.user.password = admin


Image title

Image title

We can change the log levels of the deployed instances in the runtime without the need to restart the containers.

We can add the security on the management endpoints by implementing Basic, OAuth2 or Session Authentication.

The above properties depict the way of securing management with Basic Authentication.

Source Code:

  • https://github.com/aritnag/SpringBootAdminClientUsingBasicAuthentication

References:

  • https://github.com/codecentric/spring-boot-admin

  • http://codecentric.github.io/spring-boot-admin/2.0.2/

Spring Framework Spring Boot authentication

Opinions expressed by DZone contributors are their own.

Related

  • Authentication With Remote LDAP Server in Spring WebFlux
  • Authentication With Remote LDAP Server in Spring Web MVC
  • How to Implement Two-Factor Authentication in A Spring Boot OAuth Server? Part 2: Under the Hood
  • How to Implement Two-Factor Authentication in a Spring Boot OAuth Server? Part 1: Configuration

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!