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
5a138976
Commit
5a138976
authored
6 years ago
by
Tim van Dijen
Browse files
Options
Downloads
Patches
Plain Diff
Replace SimpleSAML_AuthMemCookie with namespaced version
parent
c858a2e0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/SimpleSAML/AuthMemCookie.php
+10
-9
10 additions, 9 deletions
lib/SimpleSAML/AuthMemCookie.php
www/authmemcookie.php
+6
-6
6 additions, 6 deletions
www/authmemcookie.php
with
16 additions
and
15 deletions
lib/SimpleSAML/AuthMemCookie.php
+
10
−
9
View file @
5a138976
<?php
namespace
SimpleSAML
;
/**
* This is a helper class for the Auth MemCookie module.
...
...
@@ -10,17 +11,17 @@
*
* @deprecated This class has been deprecated and will be removed in SSP 2.0. Use the memcookie module instead.
*/
class
SimpleSAML_AuthMemCookie
{
class
AuthMemCookie
{
/**
* @var
SimpleSAML_
AuthMemCookie This is the singleton instance of this class.
* @var AuthMemCookie This is the singleton instance of this class.
*/
private
static
$instance
=
null
;
/**
* @var
\SimpleSAML\
Configuration The configuration for Auth MemCookie.
* @var Configuration The configuration for Auth MemCookie.
*/
private
$amcConfig
;
...
...
@@ -28,12 +29,12 @@ class SimpleSAML_AuthMemCookie
/**
* This function is used to retrieve the singleton instance of this class.
*
* @return
SimpleSAML_
AuthMemCookie The singleton instance of this class.
* @return AuthMemCookie The singleton instance of this class.
*/
public
static
function
getInstance
()
{
if
(
self
::
$instance
===
null
)
{
self
::
$instance
=
new
SimpleSAML_
AuthMemCookie
();
self
::
$instance
=
new
AuthMemCookie
();
}
return
self
::
$instance
;
...
...
@@ -46,7 +47,7 @@ class SimpleSAML_AuthMemCookie
private
function
__construct
()
{
// load AuthMemCookie configuration
$this
->
amcConfig
=
\SimpleSAML\
Configuration
::
getConfig
(
'authmemcookie.php'
);
$this
->
amcConfig
=
Configuration
::
getConfig
(
'authmemcookie.php'
);
}
...
...
@@ -71,7 +72,7 @@ class SimpleSAML_AuthMemCookie
{
$cookieName
=
$this
->
amcConfig
->
getString
(
'cookiename'
,
'AuthMemCookie'
);
if
(
!
is_string
(
$cookieName
)
||
strlen
(
$cookieName
)
===
0
)
{
throw
new
Exception
(
throw
new
\
Exception
(
"Configuration option 'cookiename' contains an invalid value. This option should be a string."
);
}
...
...
@@ -119,7 +120,7 @@ class SimpleSAML_AuthMemCookie
$class
=
class_exists
(
'Memcache'
)
?
'Memcache'
:
(
class_exists
(
'Memcached'
)
?
'Memcached'
:
false
);
if
(
!
$class
)
{
throw
new
Exception
(
'Missing Memcached implementation. You must install either the Memcache or Memcached extension.'
);
throw
new
\
Exception
(
'Missing Memcached implementation. You must install either the Memcache or Memcached extension.'
);
}
// Create the Memcache(d) object.
...
...
This diff is collapsed.
Click to expand it.
www/authmemcookie.php
+
6
−
6
View file @
5a138976
...
...
@@ -24,7 +24,7 @@ try {
}
// load Auth MemCookie configuration
$amc
=
SimpleSAML
_
AuthMemCookie
::
getInstance
();
$amc
=
\
SimpleSAML
\
AuthMemCookie
::
getInstance
();
$sourceId
=
$amc
->
getAuthSource
();
$s
=
new
\SimpleSAML\Auth\Simple
(
$sourceId
);
...
...
@@ -33,7 +33,7 @@ try {
$s
->
requireAuth
();
// generate session id and save it in a cookie
$sessionID
=
SimpleSAML\Utils\Random
::
generateID
();
$sessionID
=
\
SimpleSAML\Utils\Random
::
generateID
();
$cookieName
=
$amc
->
getCookieName
();
\SimpleSAML\Utils\HTTP
::
setCookie
(
$cookieName
,
$sessionID
);
...
...
@@ -45,7 +45,7 @@ try {
// username
$usernameAttr
=
$amc
->
getUsernameAttr
();
if
(
!
array_key_exists
(
$usernameAttr
,
$attributes
))
{
throw
new
Exception
(
throw
new
\
Exception
(
"The user doesn't have an attribute named '"
.
$usernameAttr
.
"'. This attribute is expected to contain the username."
);
...
...
@@ -56,7 +56,7 @@ try {
$groupsAttr
=
$amc
->
getGroupsAttr
();
if
(
$groupsAttr
!==
null
)
{
if
(
!
array_key_exists
(
$groupsAttr
,
$attributes
))
{
throw
new
Exception
(
throw
new
\
Exception
(
"The user doesn't have an attribute named '"
.
$groupsAttr
.
"'. This attribute is expected to contain the groups the user is a member of."
);
...
...
@@ -97,10 +97,10 @@ try {
// register logout handler
$session
=
\SimpleSAML\Session
::
getSessionFromRequest
();
$session
->
registerLogoutHandler
(
$sourceId
,
'SimpleSAML
_
AuthMemCookie'
,
'logoutHandler'
);
$session
->
registerLogoutHandler
(
$sourceId
,
'
\
SimpleSAML
\
AuthMemCookie'
,
'logoutHandler'
);
// redirect the user back to this page to signal that the login is completed
\SimpleSAML\Utils\HTTP
::
redirectTrustedURL
(
\SimpleSAML\Utils\HTTP
::
getSelfURL
());
}
catch
(
Exception
$e
)
{
}
catch
(
\
Exception
$e
)
{
throw
new
\SimpleSAML\Error\Error
(
'CONFIG'
,
$e
);
}
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