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
5b3da585
Commit
5b3da585
authored
Jun 10, 2016
by
Rohith
Browse files
Options
Downloads
Patches
Plain Diff
- fixing the forwarding domains check
parent
04403a8c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
forwarding.go
+1
-1
1 addition, 1 deletion
forwarding.go
util_test.go
+10
-0
10 additions, 0 deletions
util_test.go
utils.go
+13
-0
13 additions, 0 deletions
utils.go
with
24 additions
and
1 deletion
forwarding.go
+
1
−
1
View file @
5b3da585
...
...
@@ -219,7 +219,7 @@ func (r *oauthProxy) forwardProxyHandler() gin.HandlerFunc {
// step: does the host being signed?
// a) if the forwarding domain set and we are NOT in the list, just forward it
// b) else the list is zero (meaning sign all requests) or we are in the list
if
len
(
r
.
config
.
ForwardingDomains
)
>
0
&&
!
contain
edIn
(
hostname
,
r
.
config
.
ForwardingDomains
)
{
if
len
(
r
.
config
.
ForwardingDomains
)
>
0
&&
!
contain
sSubString
(
hostname
,
r
.
config
.
ForwardingDomains
)
{
goto
PROXY
}
...
...
This diff is collapsed.
Click to expand it.
util_test.go
+
10
−
0
View file @
5b3da585
...
...
@@ -202,6 +202,16 @@ func TestContainedIn(t *testing.T) {
assert
.
True
(
t
,
containedIn
(
"1"
,
[]
string
{
"1"
,
"2"
,
"3"
,
"4"
}))
}
func
TestContainsSubString
(
t
*
testing
.
T
)
{
assert
.
True
(
t
,
containsSubString
(
"svc.cluster.local"
,
[]
string
{
"nginx.pr1.svc.cluster.local"
}))
assert
.
True
(
t
,
containsSubString
(
"cluster.local"
,
[]
string
{
"nginx.pr1.svc.cluster.local"
}))
assert
.
True
(
t
,
containsSubString
(
"pr1"
,
[]
string
{
"nginx.pr1.svc.cluster.local"
}))
}
func
BenchmarkContainsSubString
(
t
*
testing
.
B
)
{
containsSubString
(
"svc.cluster.local"
,
[]
string
{
"nginx.pr1.svc.cluster.local"
})
}
func
TestDialAddress
(
t
*
testing
.
T
)
{
assert
.
Equal
(
t
,
dialAddress
(
getFakeURL
(
"http://127.0.0.1"
)),
"127.0.0.1:80"
)
assert
.
Equal
(
t
,
dialAddress
(
getFakeURL
(
"https://127.0.0.1"
)),
"127.0.0.1:443"
)
...
...
This diff is collapsed.
Click to expand it.
utils.go
+
13
−
0
View file @
5b3da585
...
...
@@ -261,6 +261,19 @@ func containedIn(value string, list []string) bool {
return
false
}
//
// containsSubString checks if substring exists
//
func
containsSubString
(
value
string
,
list
[]
string
)
bool
{
for
_
,
x
:=
range
list
{
if
strings
.
Contains
(
x
,
value
)
{
return
true
}
}
return
false
}
//
// tryDialEndpoint dials the upstream endpoint via plain
//
...
...
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