Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
dex
Commits
fcf00019
Commit
fcf00019
authored
Oct 09, 2017
by
Eric Chiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
connector/ldap: add test for InsecureSkipVerify option
parent
904c3fac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
ldap_test.go
connector/ldap/ldap_test.go
+47
-0
No files found.
connector/ldap/ldap_test.go
View file @
fcf00019
...
...
@@ -28,6 +28,7 @@ const (
connectStartTLS
connectionMethod
=
iota
connectLDAPS
connectLDAP
connectInsecureSkipVerify
)
// subtest is a login test against a given schema.
...
...
@@ -350,6 +351,49 @@ userpassword: foo
runTests
(
t
,
schema
,
connectStartTLS
,
c
,
tests
)
}
func
TestInsecureSkipVerify
(
t
*
testing
.
T
)
{
schema
:=
`
dn: dc=example,dc=org
objectClass: dcObject
objectClass: organization
o: Example Company
dc: example
dn: ou=People,dc=example,dc=org
objectClass: organizationalUnit
ou: People
dn: cn=jane,ou=People,dc=example,dc=org
objectClass: person
objectClass: inetOrgPerson
sn: doe
cn: jane
mail: janedoe@example.com
userpassword: foo
`
c
:=
&
Config
{}
c
.
UserSearch
.
BaseDN
=
"ou=People,dc=example,dc=org"
c
.
UserSearch
.
NameAttr
=
"cn"
c
.
UserSearch
.
EmailAttr
=
"mail"
c
.
UserSearch
.
IDAttr
=
"DN"
c
.
UserSearch
.
Username
=
"cn"
tests
:=
[]
subtest
{
{
name
:
"validpassword"
,
username
:
"jane"
,
password
:
"foo"
,
want
:
connector
.
Identity
{
UserID
:
"cn=jane,ou=People,dc=example,dc=org"
,
Username
:
"jane"
,
Email
:
"janedoe@example.com"
,
EmailVerified
:
true
,
},
},
}
runTests
(
t
,
schema
,
connectInsecureSkipVerify
,
c
,
tests
)
}
func
TestLDAPS
(
t
*
testing
.
T
)
{
schema
:=
`
dn: dc=example,dc=org
...
...
@@ -531,6 +575,9 @@ func runTests(t *testing.T, schema string, connMethod connectionMethod, config *
case
connectLDAPS
:
c
.
Host
=
"localhost:10636"
c
.
RootCA
=
"testdata/ca.crt"
case
connectInsecureSkipVerify
:
c
.
Host
=
"localhost:10636"
c
.
InsecureSkipVerify
=
true
case
connectLDAP
:
c
.
Host
=
"localhost:10389"
c
.
InsecureNoSSL
=
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment