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
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
GitLab 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
939cd8c1
Unverified
Commit
939cd8c1
authored
Aug 5, 2018
by
Tim van Dijen
Committed by
GitHub
Aug 5, 2018
Browse files
Options
Downloads
Patches
Plain Diff
PSR2
parent
1ddf2b79
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/expirycheck/lib/Auth/Process/ExpiryDate.php
+129
-130
129 additions, 130 deletions
modules/expirycheck/lib/Auth/Process/ExpiryDate.php
with
129 additions
and
130 deletions
modules/expirycheck/lib/Auth/Process/ExpiryDate.php
+
129
−
130
View file @
939cd8c1
...
@@ -25,8 +25,8 @@ namespace SimpleSAML\Module\expirycheck\Auth\Process;
...
@@ -25,8 +25,8 @@ namespace SimpleSAML\Module\expirycheck\Auth\Process;
class
ExpiryDate
extends
\SimpleSAML\Auth\ProcessingFilter
class
ExpiryDate
extends
\SimpleSAML\Auth\ProcessingFilter
{
{
private
$warndaysbefore
=
0
;
private
$warndaysbefore
=
0
;
private
$netid_attr
=
NULL
;
private
$netid_attr
=
null
;
private
$expirydate_attr
=
NULL
;
private
$expirydate_attr
=
null
;
private
$date_format
=
'd.m.Y'
;
private
$date_format
=
'd.m.Y'
;
...
@@ -36,7 +36,8 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter
...
@@ -36,7 +36,8 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter
* @param array $config Configuration information about this filter.
* @param array $config Configuration information about this filter.
* @param mixed $reserved For future use.
* @param mixed $reserved For future use.
*/
*/
public
function
__construct
(
$config
,
$reserved
)
{
public
function
__construct
(
$config
,
$reserved
)
{
parent
::
__construct
(
$config
,
$reserved
);
parent
::
__construct
(
$config
,
$reserved
);
assert
(
is_array
(
$config
));
assert
(
is_array
(
$config
));
...
@@ -77,7 +78,8 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter
...
@@ -77,7 +78,8 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter
* @return bool
* @return bool
*
*
*/
*/
public
function
shWarning
(
&
$state
,
$expireOnDate
,
$warndaysbefore
)
{
public
function
shWarning
(
&
$state
,
$expireOnDate
,
$warndaysbefore
)
{
$now
=
time
();
$now
=
time
();
$end
=
$expireOnDate
;
$end
=
$expireOnDate
;
...
@@ -97,7 +99,8 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter
...
@@ -97,7 +99,8 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter
* @return bool
* @return bool
*
*
*/
*/
public
function
checkDate
(
$expireOnDate
)
{
public
function
checkDate
(
$expireOnDate
)
{
$now
=
time
();
$now
=
time
();
$end
=
$expireOnDate
;
$end
=
$expireOnDate
;
...
@@ -106,7 +109,6 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter
...
@@ -106,7 +109,6 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter
}
else
{
}
else
{
return
false
;
return
false
;
}
}
}
}
/**
/**
...
@@ -114,22 +116,22 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter
...
@@ -114,22 +116,22 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter
*
*
* @param array &$state The current state.
* @param array &$state The current state.
*/
*/
public
function
process
(
&
$state
)
{
public
function
process
(
&
$state
)
{
/*
/*
* UTC format: 20090527080352Z
* UTC format: 20090527080352Z
*/
*/
$netId
=
$state
[
'Attributes'
][
$this
->
netid_attr
][
0
];
$netId
=
$state
[
'Attributes'
][
$this
->
netid_attr
][
0
];
$expireOnDate
=
strtotime
(
$state
[
'Attributes'
][
$this
->
expirydate_attr
][
0
]);
$expireOnDate
=
strtotime
(
$state
[
'Attributes'
][
$this
->
expirydate_attr
][
0
]);
if
(
self
::
shWarning
(
$state
,
$expireOnDate
,
$this
->
warndaysbefore
))
{
if
(
$this
->
shWarning
(
$state
,
$expireOnDate
,
$this
->
warndaysbefore
))
{
assert
(
is_array
(
$state
));
assert
(
is_array
(
$state
));
if
(
isset
(
$state
[
'isPassive'
])
&&
$state
[
'isPassive'
]
===
TRUE
)
{
if
(
isset
(
$state
[
'isPassive'
])
&&
$state
[
'isPassive'
]
===
true
)
{
// We have a passive request. Skip the warning.
// We have a passive request. Skip the warning.
return
;
return
;
}
}
\SimpleSAML\Logger
::
warning
(
'expirycheck: NetID '
.
$netId
.
\SimpleSAML\Logger
::
warning
(
'expirycheck: NetID '
.
$netId
.
' is about to expire!'
);
' is about to expire!'
);
// Save state and redirect
// Save state and redirect
$state
[
'expireOnDate'
]
=
date
(
$this
->
date_format
,
$expireOnDate
);
$state
[
'expireOnDate'
]
=
date
(
$this
->
date_format
,
$expireOnDate
);
...
@@ -139,7 +141,7 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter
...
@@ -139,7 +141,7 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter
\SimpleSAML\Utils\HTTP
::
redirectTrustedURL
(
$url
,
array
(
'StateId'
=>
$id
));
\SimpleSAML\Utils\HTTP
::
redirectTrustedURL
(
$url
,
array
(
'StateId'
=>
$id
));
}
}
if
(
!
self
::
checkDate
(
$expireOnDate
))
{
if
(
!
$this
->
checkDate
(
$expireOnDate
))
{
\SimpleSAML\Logger
::
error
(
'expirycheck: NetID '
.
$netId
.
\SimpleSAML\Logger
::
error
(
'expirycheck: NetID '
.
$netId
.
' has expired ['
.
date
(
$this
->
date_format
,
$expireOnDate
)
.
']. Access denied!'
);
' has expired ['
.
date
(
$this
->
date_format
,
$expireOnDate
)
.
']. Access denied!'
);
...
@@ -149,9 +151,6 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter
...
@@ -149,9 +151,6 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter
$id
=
\SimpleSAML\Auth\State
::
saveState
(
$state
,
'expirywarning:expired'
);
$id
=
\SimpleSAML\Auth\State
::
saveState
(
$state
,
'expirywarning:expired'
);
$url
=
\SimpleSAML\Module
::
getModuleURL
(
'expirycheck/expired.php'
);
$url
=
\SimpleSAML\Module
::
getModuleURL
(
'expirycheck/expired.php'
);
\SimpleSAML\Utils\HTTP
::
redirectTrustedURL
(
$url
,
array
(
'StateId'
=>
$id
));
\SimpleSAML\Utils\HTTP
::
redirectTrustedURL
(
$url
,
array
(
'StateId'
=>
$id
));
}
}
}
}
}
}
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