SlideShare a Scribd company logo
��
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
5
certbot
mkcert
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
@Configuration
public class SecurityConfiguration extends
WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.requiresChannel().anyRequest().requiresSecure();
}
}
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.requiresChannel()
.requestMatchers(r -> r.getHeader("X-Forwarded-Proto") != null)
.requiresSecure();
}
}
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
'use strict';
const fetch = require('node-fetch');
const AWS = require('aws-sdk'); // eslint-disable-line
import/no-extraneous-dependencies
const s3 = new AWS.S3();
module.exports.save = (event, context, callback) => {
fetch(event.image_url)
.then((response) => {
if (response.ok) {
return response;
}
return Promise.reject(new Error(
`Failed to fetch ${response.url}: ${response.status}
${response.statusText}`));
})
.then(response => response.buffer())
.then(buffer => (
s3.putObject({
Bucket: process.env.BUCKET,
Key: event.key,
Body: buffer,
}).promise()
))
.then(v => callback(null, v), callback);
};
'use strict';
const fetch = require('node-fetch');
const AWS = require('aws-sdk'); // eslint-disable-line
import/no-extraneous-dependencies
const s3 = new AWS.S3();
module.exports.save = (event, context, callback) => {
fetch(event.image_url)
.then((response) => {
if (response.ok) {
return response;
}
return Promise.reject(new Error(
`Failed to fetch ${response.url}: ${response.status}
${response.statusText}`));
})
.then(response => response.buffer())
.then(buffer => (
s3.putObject({
Bucket: process.env.BUCKET,
Key: event.key,
Body: buffer,
}).promise()
))
.then(v => callback(null, v), callback);
};
{
"dependencies": {
"aws-sdk": "^2.7.9",
"node-fetch": "^1.6.3"
}
}
'use strict';
const fetch = require('node-fetch');
const AWS = require('aws-sdk'); // eslint-disable-line
import/no-extraneous-dependencies
const s3 = new AWS.S3();
module.exports.save = (event, context, callback) => {
fetch(event.image_url)
.then((response) => {
if (response.ok) {
return response;
}
return Promise.reject(new Error(
`Failed to fetch ${response.url}: ${response.status}
${response.statusText}`));
})
.then(response => response.buffer())
.then(buffer => (
s3.putObject({
Bucket: process.env.BUCKET,
Key: event.key,
Body: buffer,
}).promise()
))
.then(v => callback(null, v), callback);
};
{
"dependencies": {
"aws-sdk": "^2.7.9",
"node-fetch": "^1.6.3"
}
}
'use strict';
const fetch = require('node-fetch');
const AWS = require('aws-sdk'); // eslint-disable-line
import/no-extraneous-dependencies
const s3 = new AWS.S3();
module.exports.save = (event, context, callback) => {
fetch(event.image_url)
.then((response) => {
if (response.ok) {
return response;
}
return Promise.reject(new Error(
`Failed to fetch ${response.url}: ${response.status}
${response.statusText}`));
})
.then(response => response.buffer())
.then(buffer => (
s3.putObject({
Bucket: process.env.BUCKET,
Key: event.key,
Body: buffer,
}).promise()
))
.then(v => callback(null, v), callback);
};
😱
{
"dependencies": {
"aws-sdk": "^2.7.9",
"node-fetch": "^1.6.3"
}
}
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
23
npm i -g npm-check-updates
ncu
mvn versions:display-dependency-updates
gradle dependencyUpdates 
-Drevision=release
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf()
.csrfTokenRepository(
CookieCsrfTokenRepository.withHttpOnlyFalse());
}
}
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.headers()
.contentSecurityPolicy("script-src 'self' " +
"https://trustedscripts.example.com; " +
"object-src https://trustedplugins.example.com; " +
"report-uri /csp-report-endpoint/");
}
}
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
spring:
security:
oauth2:
client:
registration:
okta:
client-id: {clientId}
client-secret: {clientSecret}
provider:
okta:
issuer-uri: https://{yourOktaDomain}/oauth2/default
@Grab('spring-boot-starter-oauth2-client')
@RestController
class Application {
@GetMapping('/')
String home(java.security.Principal user) {
'Hello ' + user.name
}
}
okta:
oauth2:
issuer: https://{yourOktaDomain}/oauth2/default
client-id: {yourClientId}
client-secret: {yourClientSecret}
<dependency>
<groupId>com.okta.spring</groupId>
<artifactId>okta-spring-boot-starter</artifactId>
<version>1.3.0</version>
</dependency>
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
🎉
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
hash("TSD") =3c9c93e0f8eb2161e5787f7cd3e4b67f8d98fbd80b7d237cc757583b06daa3e3
unhash("3c9c93e0f8eb2161e5787f7cd3e4b67f8d98fbd80b7d237cc757583b06daa3e3") = ???
hash("TSD") = 3c9c93e0f8eb2161e5787f7cd3e4b67f8d98fbd80b7d237cc757583b06daa3e3
hash("TSD") = 3c9c93e0f8eb2161e5787f7cd3e4b67f8d98fbd80b7d237cc757583b06daa3e3
hash("TSD") = 3c9c93e0f8eb2161e5787f7cd3e4b67f8d98fbd80b7d237cc757583b06daa3e3
hash("TSD") = 3c9c93e0f8eb2161e5787f7cd3e4b67f8d98fbd80b7d237cc757583b06daa3e3
hash("TSD0") = 3c9c93e0f8eb2161e5787f7cd3e4b67f8d98fbd80b7d237cc757583b06daa3e3
hash("TSD1") = 98eadd540e6c0579a1bcbe375c8d1ae2863beacdfb9af803e5f4d6dd1f8926c2
hash("TSD2") = 665ec59d7fb01f6070622780e744040239f0aaa993eae1d088bc4f0137d270ef
hash("TSD3") = 7ae89eb10a765ec2459bee59ed1d3ed97dbb9f31ec5c7bd13d19380bc39f5288
hash("TSD") = 3c9c93e0f8eb2161e5787f7cd3e4b67f8d98fbd80b7d237cc757583b06daa3e3
hash("123") != 3c9c93e0f8eb2161e5787f7cd3e4b67f8d98fbd80b7d237cc757583b06daa3e3
@Bean
public PasswordEncoder passwordEncoder() {
return new SCryptPasswordEncoder();
}
@Autowired
private PasswordEncoder passwordEncoder;
public String hashPassword(String password) {
return passwordEncoder.encode(password);
}
🐓
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
<dependencies>
<dependency>
<groupId>org.springframework.vault</groupId>
<artifactId>spring-vault-core</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
</dependencies>
@Value("${password}")
char[] password;
Printing String password -> password
Printing char[] password -> [C@6e8cf4c6
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
��
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
👌
68

More Related Content

PDF
Design & Performance - Steve Souders at Fastly Altitude 2015
PDF
HashiCorp Vault Workshop:幫 Credentials 找個窩
PPTX
Vault - Secret and Key Management
PDF
Connecting to the network
PDF
Deploying Percona XtraDB Cluster in Openshift
PDF
Data Encryption at Rest
PDF
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech Talk
PDF
VCL template abstraction model and automated deployments to Fastly
Design & Performance - Steve Souders at Fastly Altitude 2015
HashiCorp Vault Workshop:幫 Credentials 找個窩
Vault - Secret and Key Management
Connecting to the network
Deploying Percona XtraDB Cluster in Openshift
Data Encryption at Rest
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech Talk
VCL template abstraction model and automated deployments to Fastly

What's hot (20)

PDF
HashiCorp's Vault - The Examples
PPTX
Sapphire Gimlets
PPTX
hacking with node.JS
PPTX
How to deploy spark instance using ansible 2.0 in fiware lab v2
PPTX
Workshop desarrollo Cassandra con el driver Java
PDF
"Service Worker: Let Your Web App Feel Like a Native "
ODP
Introduce about Nodejs - duyetdev.com
PPTX
The State of JavaScript (2015)
PDF
Hopping in clouds: a tale of migration from one cloud provider to another
PPTX
Guice gin
PDF
End to end todo list app with NestJs - Angular - Redux & Redux Saga
PDF
Vault 1.1: Secret Caching with Vault Agent and Other New Features
PPTX
PDF
HashiCorp Vault Plugin Infrastructure
ODP
Deploy Mediawiki Using FIWARE Lab Facilities
PDF
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
PDF
KSDG-iSlide App 開發心得分享
PDF
Developing your own OpenStack Swift middleware
PDF
FwDays 2021: Metarhia Technology Stack for Node.js
DOCX
Experienced Selenium Interview questions
HashiCorp's Vault - The Examples
Sapphire Gimlets
hacking with node.JS
How to deploy spark instance using ansible 2.0 in fiware lab v2
Workshop desarrollo Cassandra con el driver Java
"Service Worker: Let Your Web App Feel Like a Native "
Introduce about Nodejs - duyetdev.com
The State of JavaScript (2015)
Hopping in clouds: a tale of migration from one cloud provider to another
Guice gin
End to end todo list app with NestJs - Angular - Redux & Redux Saga
Vault 1.1: Secret Caching with Vault Agent and Other New Features
HashiCorp Vault Plugin Infrastructure
Deploy Mediawiki Using FIWARE Lab Facilities
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
KSDG-iSlide App 開發心得分享
Developing your own OpenStack Swift middleware
FwDays 2021: Metarhia Technology Stack for Node.js
Experienced Selenium Interview questions
Ad

Similar to 10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019 (20)

PDF
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
PDF
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Belgium 2019
PDF
Service worker: discover the next web game changer
PPTX
Angular js security
PDF
Cloudcamp scotland - Using cloud without losing control
PDF
MongoDB World 2019: Life In Stitch-es
PDF
Assignment7.pdf
PPT
Expert JavaScript tricks of the masters
PDF
API 통신, Retrofit 대신 Ktor 어떠신가요.pdf
PPTX
What mom never told you about bundle configurations - Symfony Live Paris 2012
 
PDF
Workboxで始める Service Worker
PDF
Min-Maxing Software Costs
PDF
Bonnes pratiques de développement avec Node js
PDF
Virtual Madness @ Etsy
PDF
Streaming using Kafka Flink & Elasticsearch
PDF
Intro to Sail.js
PDF
Modern Android app library stack
PDF
NoSQL and JavaScript: a Love Story
PDF
Lazy evaluation drupal camp moscow 2014
PDF
前端MVC 豆瓣说
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Belgium 2019
Service worker: discover the next web game changer
Angular js security
Cloudcamp scotland - Using cloud without losing control
MongoDB World 2019: Life In Stitch-es
Assignment7.pdf
Expert JavaScript tricks of the masters
API 통신, Retrofit 대신 Ktor 어떠신가요.pdf
What mom never told you about bundle configurations - Symfony Live Paris 2012
 
Workboxで始める Service Worker
Min-Maxing Software Costs
Bonnes pratiques de développement avec Node js
Virtual Madness @ Etsy
Streaming using Kafka Flink & Elasticsearch
Intro to Sail.js
Modern Android app library stack
NoSQL and JavaScript: a Love Story
Lazy evaluation drupal camp moscow 2014
前端MVC 豆瓣说
Ad

More from Matt Raible (20)

PDF
Keep Identities in Sync the SCIMple Way - ApacheCon NA 2022
PDF
Micro Frontends for Java Microservices - Belfast JUG 2022
PDF
Micro Frontends for Java Microservices - Dublin JUG 2022
PDF
Micro Frontends for Java Microservices - Cork JUG 2022
PDF
Comparing Native Java REST API Frameworks - Seattle JUG 2022
PDF
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
PDF
Comparing Native Java REST API Frameworks - Devoxx France 2022
PDF
Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...
PDF
Native Java with Spring Boot and JHipster - Garden State JUG 2021
PDF
Java REST API Framework Comparison - PWX 2021
PDF
Web App Security for Java Developers - PWX 2021
PDF
Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...
PDF
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...
PDF
Web App Security for Java Developers - UberConf 2021
PDF
Java REST API Framework Comparison - UberConf 2021
PDF
Native Java with Spring Boot and JHipster - SF JUG 2021
PDF
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
PDF
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021
PDF
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
PDF
JHipster and Okta - JHipster Virtual Meetup December 2020
Keep Identities in Sync the SCIMple Way - ApacheCon NA 2022
Micro Frontends for Java Microservices - Belfast JUG 2022
Micro Frontends for Java Microservices - Dublin JUG 2022
Micro Frontends for Java Microservices - Cork JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Comparing Native Java REST API Frameworks - Devoxx France 2022
Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...
Native Java with Spring Boot and JHipster - Garden State JUG 2021
Java REST API Framework Comparison - PWX 2021
Web App Security for Java Developers - PWX 2021
Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...
Web App Security for Java Developers - UberConf 2021
Java REST API Framework Comparison - UberConf 2021
Native Java with Spring Boot and JHipster - SF JUG 2021
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
JHipster and Okta - JHipster Virtual Meetup December 2020

Recently uploaded (20)

PDF
top salesforce developer skills in 2025.pdf
PPTX
Transform Your Business with a Software ERP System
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Cost to Outsource Software Development in 2025
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
medical staffing services at VALiNTRY
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
System and Network Administraation Chapter 3
PPTX
Introduction to Artificial Intelligence
PDF
Digital Strategies for Manufacturing Companies
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
assetexplorer- product-overview - presentation
top salesforce developer skills in 2025.pdf
Transform Your Business with a Software ERP System
Operating system designcfffgfgggggggvggggggggg
Cost to Outsource Software Development in 2025
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
medical staffing services at VALiNTRY
Wondershare Filmora 15 Crack With Activation Key [2025
System and Network Administraation Chapter 3
Introduction to Artificial Intelligence
Digital Strategies for Manufacturing Companies
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Design an Analysis of Algorithms II-SECS-1021-03
L1 - Introduction to python Backend.pptx
Odoo POS Development Services by CandidRoot Solutions
assetexplorer- product-overview - presentation

10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019