Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp-module-perun
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp-module-perun
Merge requests
!120
LDAP startTLS support (port 389)
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
LDAP startTLS support (port 389)
github/fork/melanger/patch-6
into
master
Overview
1
Commits
3
Pipelines
0
Changes
3
Merged
Pavel Břoušek
requested to merge
github/fork/melanger/patch-6
into
master
4 years ago
Overview
1
Commits
3
Pipelines
0
Changes
1
Expand
Created by: melanger
👍
0
👎
0
Merge request reports
Viewing commit
b725367b
Prev
Next
Show latest version
1 file
+
11
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Unverified
b725367b
LDAP startTLS support (port 389)
· b725367b
Pavel Břoušek
authored
4 years ago
lib/LdapConnector.php
+
11
−
1
Options
@@ -31,18 +31,21 @@ class LdapConnector
private
$hostname
;
private
$user
;
private
$password
;
private
$enableTLS
;
/**
* LdapConnector constructor.
* @param $hostname
* @param $user
* @param $password
* @param $enableTLS
*/
public
function
__construct
(
$hostname
,
$user
,
$password
)
public
function
__construct
(
$hostname
,
$user
,
$password
,
$enableTLS
=
false
)
{
$this
->
hostname
=
$hostname
;
$this
->
user
=
$user
;
$this
->
password
=
$password
;
$this
->
enableTLS
=
$enableTLS
;
}
/**
@@ -108,6 +111,13 @@ class LdapConnector
}
ldap_set_option
(
$conn
,
LDAP_OPT_PROTOCOL_VERSION
,
3
);
// Enable TLS, if needed
if
(
$this
->
enableTLS
&&
stripos
(
$this
->
hostname
,
"ldaps:"
)
===
false
)
{
if
(
!@
ldap_start_tls
(
$conn
))
{
throw
new
Exception
(
'Unable to force TLS on Perun LDAP'
);
}
}
if
(
ldap_bind
(
$conn
,
$this
->
user
,
$this
->
password
)
===
false
)
{
throw
new
Exception
(
'Unable to bind user to the Perun LDAP, '
.
$this
->
hostname
);
Loading