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
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
c44ff1ac
Commit
c44ff1ac
authored
10 years ago
by
Jaime Perez
Browse files
Options
Downloads
Patches
Plain Diff
aselect: reformat code in www/credentials.php.
parent
835255fc
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/aselect/www/credentials.php
+52
-45
52 additions, 45 deletions
modules/aselect/www/credentials.php
with
52 additions
and
45 deletions
modules/aselect/www/credentials.php
+
52
−
45
View file @
c44ff1ac
...
@@ -6,48 +6,55 @@
...
@@ -6,48 +6,55 @@
*
*
* @author Wessel Dankers, Tilburg University
* @author Wessel Dankers, Tilburg University
*/
*/
if
(
!
array_key_exists
(
'ssp_state'
,
$_REQUEST
))
if
(
!
array_key_exists
(
'ssp_state'
,
$_REQUEST
))
{
throw
new
SimpleSAML_Error_Exception
(
"Missing ssp_state parameter"
);
throw
new
SimpleSAML_Error_Exception
(
"Missing ssp_state parameter"
);
$id
=
$_REQUEST
[
'ssp_state'
];
}
$id
=
$_REQUEST
[
'ssp_state'
];
// sanitize the input
$sid
=
SimpleSAML_Utilities
::
parseStateID
(
$id
);
// sanitize the input
if
(
!
is_null
(
$sid
[
'url'
]))
{
$sid
=
SimpleSAML_Utilities
::
parseStateID
(
$id
);
SimpleSAML_Utilities
::
checkURLAllowed
(
$sid
[
'url'
]);
if
(
!
is_null
(
$sid
[
'url'
]))
{
}
SimpleSAML_Utilities
::
checkURLAllowed
(
$sid
[
'url'
]);
}
$state
=
SimpleSAML_Auth_State
::
loadState
(
$id
,
'aselect:login'
);
$state
=
SimpleSAML_Auth_State
::
loadState
(
$id
,
'aselect:login'
);
if
(
!
array_key_exists
(
'a-select-server'
,
$_REQUEST
))
SimpleSAML_Auth_State
::
throwException
(
$state
,
new
SimpleSAML_Error_Exception
(
"Missing a-select-server parameter"
));
if
(
!
array_key_exists
(
'a-select-server'
,
$_REQUEST
))
{
$server_id
=
$_REQUEST
[
'a-select-server'
];
SimpleSAML_Auth_State
::
throwException
(
$state
,
new
SimpleSAML_Error_Exception
(
"Missing a-select-server parameter"
));
}
if
(
!
array_key_exists
(
'aselect_credentials'
,
$_REQUEST
))
$server_id
=
$_REQUEST
[
'a-select-server'
];
SimpleSAML_Auth_State
::
throwException
(
$state
,
new
SimpleSAML_Error_Exception
(
"Missing aselect_credentials parameter"
));
$credentials
=
$_REQUEST
[
'aselect_credentials'
];
if
(
!
array_key_exists
(
'aselect_credentials'
,
$_REQUEST
))
{
SimpleSAML_Auth_State
::
throwException
(
$state
,
if
(
!
array_key_exists
(
'rid'
,
$_REQUEST
))
new
SimpleSAML_Error_Exception
(
"Missing aselect_credentials parameter"
));
SimpleSAML_Auth_State
::
throwException
(
$state
,
new
SimpleSAML_Error_Exception
(
"Missing rid parameter"
));
}
$rid
=
$_REQUEST
[
'rid'
];
$credentials
=
$_REQUEST
[
'aselect_credentials'
];
try
{
if
(
!
array_key_exists
(
'rid'
,
$_REQUEST
))
{
if
(
!
array_key_exists
(
'aselect::authid'
,
$state
))
SimpleSAML_Auth_State
::
throwException
(
$state
,
new
SimpleSAML_Error_Exception
(
"Missing rid parameter"
));
throw
new
SimpleSAML_Error_Exception
(
"ASelect authentication source missing in state"
);
}
$authid
=
$state
[
'aselect::authid'
];
$rid
=
$_REQUEST
[
'rid'
];
$aselect
=
SimpleSAML_Auth_Source
::
getById
(
$authid
);
if
(
is_null
(
$aselect
))
try
{
throw
new
SimpleSAML_Error_Exception
(
"Could not find authentication source with id
$authid
"
);
if
(
!
array_key_exists
(
'aselect::authid'
,
$state
))
{
$creds
=
$aselect
->
verify_credentials
(
$server_id
,
$credentials
,
$rid
);
throw
new
SimpleSAML_Error_Exception
(
"ASelect authentication source missing in state"
);
}
if
(
array_key_exists
(
'attributes'
,
$creds
))
{
$authid
=
$state
[
'aselect::authid'
];
$state
[
'Attributes'
]
=
$creds
[
'attributes'
];
$aselect
=
SimpleSAML_Auth_Source
::
getById
(
$authid
);
}
else
{
if
(
is_null
(
$aselect
))
{
$res
=
$creds
[
'res'
];
throw
new
SimpleSAML_Error_Exception
(
"Could not find authentication source with id
$authid
"
);
$state
[
'Attributes'
]
=
array
(
'uid'
=>
array
(
$res
[
'uid'
]),
'organization'
=>
array
(
$res
[
'organization'
]));
}
}
$creds
=
$aselect
->
verify_credentials
(
$server_id
,
$credentials
,
$rid
);
}
catch
(
Exception
$e
)
{
SimpleSAML_Auth_State
::
throwException
(
$state
,
$e
);
if
(
array_key_exists
(
'attributes'
,
$creds
))
{
}
$state
[
'Attributes'
]
=
$creds
[
'attributes'
];
}
else
{
SimpleSAML_Auth_Source
::
completeAuth
(
$state
);
$res
=
$creds
[
'res'
];
SimpleSAML_Auth_State
::
throwException
(
$state
,
new
SimpleSAML_Error_Exception
(
"Internal error in A-Select component"
));
$state
[
'Attributes'
]
=
array
(
'uid'
=>
array
(
$res
[
'uid'
]),
'organization'
=>
array
(
$res
[
'organization'
]));
}
}
catch
(
Exception
$e
)
{
SimpleSAML_Auth_State
::
throwException
(
$state
,
$e
);
}
SimpleSAML_Auth_Source
::
completeAuth
(
$state
);
SimpleSAML_Auth_State
::
throwException
(
$state
,
new
SimpleSAML_Error_Exception
(
"Internal error in A-Select component"
));
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