refactor: rename middleware type

This commit is contained in:
Jonas Kaninda
2024-10-29 22:55:09 +01:00
parent 4a562e2854
commit e9af89e5be
3 changed files with 16 additions and 16 deletions

View File

@@ -168,7 +168,7 @@ gateway:
- https://dev.example.com - https://dev.example.com
- http://localhost:3000 - http://localhost:3000
- https://example.com - https://example.com
# Route Cors headers, global cors will be overridden by route # Route Cors headers, route will override global cors
headers: headers:
Access-Control-Allow-Methods: 'GET' Access-Control-Allow-Methods: 'GET'
Access-Control-Allow-Headers: 'Origin, Authorization, Accept, Content-Type, Access-Control-Allow-Headers, X-Client-Id, X-Session-Id' Access-Control-Allow-Headers: 'Origin, Authorization, Accept, Content-Type, Access-Control-Allow-Headers, X-Client-Id, X-Session-Id'
@@ -189,22 +189,22 @@ gateway:
- path: /user - path: /user
# Rules defines which specific middleware applies to a route path # Rules defines which specific middleware applies to a route path
rules: rules:
- basic-auth #Middleware name - basic-auth
# path to protect # path to protect
- path: /path-example - path: /path-example
# Rules defines which specific middleware applies to a route path # Rules defines which specific middleware applies to a route path
rules: rules:
- jwt #Middleware name - jwtAuth
# path to protect # path to protect
- path: /admin - path: /admin
# Rules defines which specific middleware applies to a route path # Rules defines which specific middleware applies to a route path
rules: rules:
- basic-auth #Middleware name - basic-auth
# path to protect # path to protect
- path: /path-example - path: /path-example
# Rules defines which specific middleware applies to a route path # Rules defines which specific middleware applies to a route path
rules: rules:
- jwt # Middleware name - jwtAuth
- path: /history - path: /history
http: http:
url: http://security-service:8080/security/authUser url: http://security-service:8080/security/authUser
@@ -236,17 +236,17 @@ gateway:
#Defines proxy middlewares #Defines proxy middlewares
middlewares: middlewares:
# Enable Basic auth authorization based # Enable Basic auth authorization based
- name: basic-auth - name: local-auth-basic
# Authentication types | jwtAuth, basicAuth, auth0 # Authentication types | jwtAuth, basicAuth, auth0
type: basicAuth type: basic
rule: rule:
username: admin username: admin
password: admin password: admin
#Enables JWT authorization based on the result of a request and continues the request. #Enables JWT authorization based on the result of a request and continues the request.
- name: jwt - name: google-auth
# Authentication types | jwtAuth, basicAuth, OAuth # Authentication types | jwtAuth, basicAuth, OAuth
# jwt authorization based on the result of backend's response and continue the request when the client is authorized # jwt authorization based on the result of backend's response and continue the request when the client is authorized
type: jwtAuth type: jwt
rule: rule:
# This is an example URL # This is an example URL
url: https://www.googleapis.com/auth/userinfo.email url: https://www.googleapis.com/auth/userinfo.email

View File

@@ -58,7 +58,7 @@ gateway:
- https://dev.example.com - https://dev.example.com
- http://localhost:3000 - http://localhost:3000
- https://example.com - https://example.com
# Route Cors headers, global cors will be overridden by route # Route Cors headers, route will override global cors
headers: headers:
Access-Control-Allow-Methods: 'GET' Access-Control-Allow-Methods: 'GET'
Access-Control-Allow-Headers: 'Origin, Authorization, Accept, Content-Type, Access-Control-Allow-Headers, X-Client-Id, X-Session-Id' Access-Control-Allow-Headers: 'Origin, Authorization, Accept, Content-Type, Access-Control-Allow-Headers, X-Client-Id, X-Session-Id'
@@ -127,16 +127,16 @@ gateway:
middlewares: middlewares:
# Enable Basic auth authorization based # Enable Basic auth authorization based
- name: local-auth-basic - name: local-auth-basic
# Authentication types | jwtAuth, basicAuth, auth0 # Authentication types | jwt, basic, OAuth
type: basicAuth type: basic
rule: rule:
username: admin username: admin
password: admin password: admin
#Enables JWT authorization based on the result of a request and continues the request. #Enables JWT authorization based on the result of a request and continues the request.
- name: google-auth - name: google-auth
# Authentication types | jwtAuth, basicAuth, OAuth # Authentication types | jwt, basic, OAuth
# jwt authorization based on the result of backend's response and continue the request when the client is authorized # jwt authorization based on the result of backend's response and continue the request when the client is authorized
type: jwtAuth type: jwt
rule: rule:
# This is an example URL # This is an example URL
url: https://www.googleapis.com/auth/userinfo.email url: https://www.googleapis.com/auth/userinfo.email

View File

@@ -296,14 +296,14 @@ func initConfig(configFile string) {
Middlewares: []Middleware{ Middlewares: []Middleware{
{ {
Name: "basic-auth", Name: "basic-auth",
Type: basicAuth, Type: "basic",
Rule: BasicRule{ Rule: BasicRule{
Username: "goma", Username: "goma",
Password: "goma", Password: "goma",
}, },
}, { }, {
Name: "jwt", Name: "jwt",
Type: jwtAuth, Type: "jwt",
Rule: JWTRuler{ Rule: JWTRuler{
URL: "https://www.googleapis.com/auth/userinfo.email", URL: "https://www.googleapis.com/auth/userinfo.email",
RequiredHeaders: []string{ RequiredHeaders: []string{