Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
keycloak-proxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Janne Mareike Koschinski
keycloak-proxy
Commits
ce5579fd
Commit
ce5579fd
authored
Feb 20, 2016
by
Rohith
Browse files
Options
Downloads
Patches
Plain Diff
- adding the security filter option
- adding the command line option for the secuirity handler
parent
636c6d28
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
config.go
+8
-1
8 additions, 1 deletion
config.go
config_sample.yml
+2
-0
2 additions, 0 deletions
config_sample.yml
doc.go
+2
-0
2 additions, 0 deletions
doc.go
handlers.go
+6
-4
6 additions, 4 deletions
handlers.go
server.go
+3
-4
3 additions, 4 deletions
server.go
with
21 additions
and
9 deletions
config.go
+
8
−
1
View file @
ce5579fd
...
...
@@ -185,6 +185,9 @@ func readOptions(cx *cli.Context, config *Config) (err error) {
if
cx
.
IsSet
(
"max-session"
)
{
config
.
MaxSession
=
cx
.
Duration
(
"max-session"
)
}
if
cx
.
IsSet
(
"enable-security-filter"
)
{
config
.
EnableSecurityFilter
=
true
}
if
cx
.
IsSet
(
"proxy-protocol"
)
{
config
.
ProxyProtocol
=
cx
.
Bool
(
"proxy-protocol"
)
}
...
...
@@ -321,7 +324,7 @@ func getOptions() []cli.Flag {
},
cli
.
StringSliceFlag
{
Name
:
"hostname"
,
Usage
:
"a list of hostname
which
the service will respond to, defaults to all"
,
Usage
:
"a list of hostname
s
the service will respond to, defaults to all"
,
},
cli
.
StringFlag
{
Name
:
"tls-cert"
,
...
...
@@ -388,6 +391,10 @@ func getOptions() []cli.Flag {
Name
:
"cors-credentials"
,
Usage
:
"the credentials access control header (Access-Control-Allow-Credentials)"
,
},
cli
.
BoolFlag
{
Name
:
"enable-security-filter"
,
Usage
:
"enables the security filter handler"
,
},
cli
.
BoolFlag
{
Name
:
"skip-token-verification"
,
Usage
:
"testing purposes ONLY, the option allows you to bypass the token verification, expiration and roles are still enforced"
,
...
...
This diff is collapsed.
Click to expand it.
config_sample.yml
+
2
−
0
View file @
ce5579fd
...
...
@@ -31,6 +31,8 @@ upstream-keepalives: true
# additional scopes to add to add to the default (openid+email+profile)
scopes
:
-
vpn-user
# enables a more extra secuirty features
enable-security-filter
:
true
# a map of claims that MUST exist in the token presented and the value is it MUST match
# So for example, you could match the audience or the issuer or some custom attribute
claims
:
...
...
This diff is collapsed.
Click to expand it.
doc.go
+
2
−
0
View file @
ce5579fd
...
...
@@ -97,6 +97,8 @@ type Config struct {
Secret
string
`json:"secret" yaml:"secret"`
// RedirectionURL the redirection url
RedirectionURL
string
`json:"redirection_url" yaml:"redirection_url"`
// EnableSecurityFilter enabled the security handler
EnableSecurityFilter
bool
`json:"enable-security-filter" yaml:"enable-security-filter"`
// RefreshSessions enabled refresh access
RefreshSessions
bool
`json:"refresh_sessions" yaml:"refresh_sessions"`
// EncryptionKey is the encryption key used to encrypt the refresh token
...
...
This diff is collapsed.
Click to expand it.
handlers.go
+
6
−
4
View file @
ce5579fd
...
...
@@ -72,6 +72,8 @@ func (r *KeycloakProxy) securityHandler() gin.HandlerFunc {
BrowserXssFilter
:
true
,
ContentTypeNosniff
:
true
,
FrameDeny
:
true
,
STSIncludeSubdomains
:
true
,
STSSeconds
:
31536000
,
})
return
func
(
cx
*
gin
.
Context
)
{
...
...
This diff is collapsed.
Click to expand it.
server.go
+
3
−
4
View file @
ce5579fd
...
...
@@ -24,7 +24,6 @@ import (
"net/http"
"net/http/httputil"
"net/url"
"os"
"strings"
"sync"
"time"
...
...
@@ -123,9 +122,9 @@ func (r KeycloakProxy) initializeRouter() {
if
r
.
config
.
LogRequests
{
r
.
router
.
Use
(
r
.
loggingHandler
())
}
// step:
if gin release production
if
os
.
Getenv
(
"GIN_MODE"
)
==
"release"
{
log
.
Infof
(
"enabling the security handler
for release mode
"
)
// step:
enabling the security filter?
if
r
.
config
.
EnableSecurityFilter
{
log
.
Infof
(
"enabling the security handler"
)
r
.
router
.
Use
(
r
.
securityHandler
())
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment