NOTICE: This app is for demo purposes only and is not suitable for production use.
A Spring Boot app that can run with various types of auth configured by setting the appropriate Spring Profile.
This app is useful in testing the HTTP Sink Connector.
- Simple Auth (No Authentication) (Profile:
simple-auth
) - Basic Auth (Profile:
basic-auth
) - OAuth2 (Profile:
oauth2
) - SSL with Basic Auth (Profile:
ssl-basic-auth
) - SSL with Mutual TLS Auth (Profile:
ssl-auth
)
-
Set profile
SPRING_PROFILES_ACTIVE=simple-auth
-
Run the app
-
Call any endpoint
# create a message curl -X POST \ http://localhost:8080/api/messages \ -d message-goes-here # get all messages curl -X POST http://localhost:8080/api/messages
-
Set profile
SPRING_PROFILES_ACTIVE=basic-auth
-
Run the app
-
Call endpoints with Basic Auth Header
# create a message curl -X POST \ http://localhost:8080/api/messages \ -H 'Authorization: Basic YWRtaW46cGFzc3dvcmQ=' -d message-goes-here # get all messages curl -X POST \ http://localhost:8080/api/messages \ -H 'Authorization: Basic YWRtaW46cGFzc3dvcmQ='
-
Set profile
SPRING_PROFILES_ACTIVE=oauth2
-
Run the app
-
Create Token
curl -X POST \ http://localhost:8080/oauth/token \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'Authorization: Basic a2MtY2xpZW50OmtjLXNlY3JldA==' \ -d 'grant_type=client_credentials&scope=any'
-
Use Token (substitute
{token}
with value from previous step)# create a message curl -X POST \ http://localhost:8080/api/messages \ -H 'Authorization: Bearer {token}' -d message-goes-here curl -X GET \ http://localhost:8080/api/messages \ -H 'Authorization: Bearer {token}'
- Set profile
SPRING_PROFILES_ACTIVE=ssl-basic-auth
- Use certs with
http-service-ssl-basic-auth
names in root of project to call endpoints
Notes:
- port
8443
is used instead of8080
- _keystore.http-service-ssl-basic-auth.jks and truststore.http-service-ssl-basic-auth.jks were generated with this command:
./certs-create.sh
- Set profile
SPRING_PROFILES_ACTIVE=ssl-auth
- Use certs with
http-service-mtls-auth
names in root of project to call endpoints
Notes:
- port
8443
is used instead of8080
- _keystore.http-service-mtls-auth.jks and truststore.http-service-mtls-auth.jks were generated with this command:
./certs-create.sh
docker buildx build --push --tag vdesabou/nginx_proxy:latest -o type=image --platform=linux/arm64,linux/amd64 .