You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-10
Original file line number
Diff line number
Diff line change
@@ -25,15 +25,15 @@
25
25
Keycloak-proxy is a proxy service which at the risk of stating the obvious integrates with the [Keycloak](https://github.com/keycloak/keycloak) authentication service. Although technically the service has no dependency on Keycloak itself and would quite happily work with any OpenID provider. The service supports both access tokens in browser cookie or bearer tokens.
@@ -230,13 +231,13 @@ Note the HTTP routing rules following the guidelines from [echo](https://echo.la
230
231
231
232
Although the role extensions do require a Keycloak IDP or at the very least a IDP that produces a token which contains roles, there's nothing stopping you from using it against any OpenID providers, such as Google. Go to the Google Developers Console and create a new application *(via "Enable and Manage APIs -> Credentials)*. Once you've created the application, take the client id, secret and make sure you've added the callback url to the application scope *(using the default this would be http://127.0.0.1:3000/oauth/callback)*
Open a browser an go to http://127.0.0.1:3000 and you should be redirected to Google for authenticate and back the application when done and you should see something like the below.
@@ -259,7 +260,6 @@ Example setup:
259
260
You have collection of micro-services which are permitted to speak to one another; you've already setup the credentials, roles, clients etc in Keycloak, providing granular role controls over issue tokens.
260
261
261
262
```YAML
262
-
# kubernetes pod example
263
263
- name: keycloak-proxy
264
264
image: quay.io/gambol99/keycloak-proxy:latest
265
265
args:
@@ -287,7 +287,7 @@ Receiver side you could setup the keycloak-proxy (--no=redirects=true) and permi
287
287
288
288
#### **Forwarding Signing HTTPS Connect**
289
289
290
-
Handling HTTPS requires man in the middling the TLS connection. By default if no -tls-ca-cert and -tls-ca-key is provided the proxy will use the default certificate. If you wish to verify the trust, you'll need to generate a CA, for example
290
+
Handling HTTPS requires man in the middling the TLS connection. By default if no -tls-ca-cert and -tls-ca-key is provided the proxy will use the default certificate. If you wish to verify the trust, you'll need to generate a CA, for example.
@@ -312,6 +312,10 @@ The proxy supports http listener, though the only real requirement for this woul
312
312
--enable-https-redirection
313
313
```
314
314
315
+
#### **Access Token Encryption**
316
+
317
+
By default the session token *(i.e. access/id token)* is placed into a cookie in plaintext. If prefer you to encrypt the session cookie using --enable-encrypted-token and --encryption-key options. Note, the access token forwarded in the X-Auth-Token header to upstream is unaffected.
318
+
315
319
#### **Upstream Headers**
316
320
317
321
On protected resources the upstream endpoint will receive a number of headers added by the proxy, along with an custom claims.
Copy file name to clipboardExpand all lines: doc.go
+6-2
Original file line number
Diff line number
Diff line change
@@ -76,6 +76,8 @@ var (
76
76
ErrRefreshTokenExpired=errors.New("the refresh token has expired")
77
77
// ErrNoTokenAudience indicates their is not audience in the token
78
78
ErrNoTokenAudience=errors.New("the token does not audience in claims")
79
+
// ErrDecryption indicates we can't decrypt the token
80
+
ErrDecryption=errors.New("failed to decrypt token")
79
81
)
80
82
81
83
// Resource represents a url resource to protect
@@ -119,6 +121,8 @@ type Config struct {
119
121
// Headers permits adding customs headers across the board
120
122
Headersmap[string]string`json:"headers" yaml:"headers" usage:"custom headers to the upstream request, key=value"`
121
123
124
+
// EnableEncryptedToken indicates the access token should be encoded
125
+
EnableEncryptedTokenbool`json:"enable-encrypted-token" yaml:"enable-encrypted-token" usage:"enable encryption for the access tokens"`
122
126
// EnableLogging indicates if we should log all the requests
123
127
EnableLoggingbool`json:"enable-logging" yaml:"enable-logging" usage:"enable http logging of the requests"`
124
128
// EnableJSONLogging is the logging format
@@ -189,12 +193,12 @@ type Config struct {
189
193
CorsHeaders []string`json:"cors-headers" yaml:"cors-headers" usage:"set of headers to add to the CORS access control (Access-Control-Allow-Headers)"`
190
194
// CorsExposedHeaders are the exposed header fields
191
195
CorsExposedHeaders []string`json:"cors-exposed-headers" yaml:"cors-exposed-headers" usage:"expose cors headers access control (Access-Control-Expose-Headers)"`
192
-
// CorsCredentials set the creds flag
196
+
// CorsCredentials set the credentials flag
193
197
CorsCredentialsbool`json:"cors-credentials" yaml:"cors-credentials" usage:"credentials access control header (Access-Control-Allow-Credentials)"`
194
198
// CorsMaxAge is the age for CORS
195
199
CorsMaxAge time.Duration`json:"cors-max-age" yaml:"cors-max-age" usage:"max age applied to cors headers (Access-Control-Max-Age)"`
196
200
197
-
// Hostname is a list of hostname's the service should response to
201
+
// Hostnames is a list of hostname's the service should response to
198
202
Hostnames []string`json:"hostnames" yaml:"hostnames" usage:"list of hostnames the service will respond to"`
199
203
200
204
// Store is a url for a store resource, used to hold the refresh tokens
0 commit comments