Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
a30c0417
Unverified
Commit
a30c0417
authored
7 years ago
by
Tim van Dijen
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
PSR-2
parent
3cc613e9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/sqlauth/lib/Auth/Source/SQL.php
+10
-13
10 additions, 13 deletions
modules/sqlauth/lib/Auth/Source/SQL.php
with
10 additions
and
13 deletions
modules/sqlauth/lib/Auth/Source/SQL.php
+
10
−
13
View file @
a30c0417
...
@@ -8,27 +8,24 @@
...
@@ -8,27 +8,24 @@
*
*
* @package SimpleSAMLphp
* @package SimpleSAMLphp
*/
*/
class
sspmod_sqlauth_Auth_Source_SQL
extends
sspmod_core_Auth_UserPassBase
{
class
sspmod_sqlauth_Auth_Source_SQL
extends
sspmod_core_Auth_UserPassBase
{
/**
/**
* The DSN we should connect to.
* The DSN we should connect to.
*/
*/
private
$dsn
;
private
$dsn
;
/**
/**
* The username we should connect to the database with.
* The username we should connect to the database with.
*/
*/
private
$username
;
private
$username
;
/**
/**
* The password we should connect to the database with.
* The password we should connect to the database with.
*/
*/
private
$password
;
private
$password
;
/**
/**
* The query we should use to retrieve the attributes for the user.
* The query we should use to retrieve the attributes for the user.
*
*
...
@@ -36,14 +33,14 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase {
...
@@ -36,14 +33,14 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase {
*/
*/
private
$query
;
private
$query
;
/**
/**
* Constructor for this authentication source.
* Constructor for this authentication source.
*
*
* @param array $info Information about this authentication source.
* @param array $info Information about this authentication source.
* @param array $config Configuration.
* @param array $config Configuration.
*/
*/
public
function
__construct
(
$info
,
$config
)
{
public
function
__construct
(
$info
,
$config
)
{
assert
(
is_array
(
$info
));
assert
(
is_array
(
$info
));
assert
(
is_array
(
$config
));
assert
(
is_array
(
$config
));
...
@@ -77,7 +74,8 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase {
...
@@ -77,7 +74,8 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase {
*
*
* @return PDO The database connection.
* @return PDO The database connection.
*/
*/
private
function
connect
()
{
private
function
connect
()
{
try
{
try
{
$db
=
new
PDO
(
$this
->
dsn
,
$this
->
username
,
$this
->
password
);
$db
=
new
PDO
(
$this
->
dsn
,
$this
->
username
,
$this
->
password
);
}
catch
(
PDOException
$e
)
{
}
catch
(
PDOException
$e
)
{
...
@@ -87,7 +85,6 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase {
...
@@ -87,7 +85,6 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase {
$db
->
setAttribute
(
PDO
::
ATTR_ERRMODE
,
PDO
::
ERRMODE_EXCEPTION
);
$db
->
setAttribute
(
PDO
::
ATTR_ERRMODE
,
PDO
::
ERRMODE_EXCEPTION
);
$driver
=
explode
(
':'
,
$this
->
dsn
,
2
);
$driver
=
explode
(
':'
,
$this
->
dsn
,
2
);
$driver
=
strtolower
(
$driver
[
0
]);
$driver
=
strtolower
(
$driver
[
0
]);
...
@@ -120,7 +117,8 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase {
...
@@ -120,7 +117,8 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase {
* @param string $password The password the user wrote.
* @param string $password The password the user wrote.
* @return array Associative array with the users attributes.
* @return array Associative array with the users attributes.
*/
*/
protected
function
login
(
$username
,
$password
)
{
protected
function
login
(
$username
,
$password
)
{
assert
(
is_string
(
$username
));
assert
(
is_string
(
$username
));
assert
(
is_string
(
$password
));
assert
(
is_string
(
$password
));
...
@@ -134,7 +132,7 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase {
...
@@ -134,7 +132,7 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase {
}
}
try
{
try
{
$res
=
$sth
->
execute
(
array
(
'username'
=>
$username
,
'password'
=>
$password
));
$sth
->
execute
(
array
(
'username'
=>
$username
,
'password'
=>
$password
));
}
catch
(
PDOException
$e
)
{
}
catch
(
PDOException
$e
)
{
throw
new
Exception
(
'sqlauth:'
.
$this
->
authId
.
throw
new
Exception
(
'sqlauth:'
.
$this
->
authId
.
': - Failed to execute query: '
.
$e
->
getMessage
());
': - Failed to execute query: '
.
$e
->
getMessage
());
...
@@ -165,7 +163,7 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase {
...
@@ -165,7 +163,7 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase {
foreach
(
$data
as
$row
)
{
foreach
(
$data
as
$row
)
{
foreach
(
$row
as
$name
=>
$value
)
{
foreach
(
$row
as
$name
=>
$value
)
{
if
(
$value
===
NULL
)
{
if
(
$value
===
null
)
{
continue
;
continue
;
}
}
...
@@ -189,5 +187,4 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase {
...
@@ -189,5 +187,4 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase {
return
$attributes
;
return
$attributes
;
}
}
}
}
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