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
60281118
Unverified
Commit
60281118
authored
7 years ago
by
Tim van Dijen
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
adfs: Configurable signature algorithm
parent
d8ee7594
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/adfs/lib/IdP/ADFS.php
+19
-3
19 additions, 3 deletions
modules/adfs/lib/IdP/ADFS.php
with
19 additions
and
3 deletions
modules/adfs/lib/IdP/ADFS.php
+
19
−
3
View file @
60281118
...
@@ -102,7 +102,7 @@ MSG;
...
@@ -102,7 +102,7 @@ MSG;
return
$result
;
return
$result
;
}
}
private
static
function
signResponse
(
$response
,
$key
,
$cert
)
private
static
function
signResponse
(
$response
,
$key
,
$cert
,
$algo
)
{
{
$objXMLSecDSig
=
new
XMLSecurityDSig
();
$objXMLSecDSig
=
new
XMLSecurityDSig
();
$objXMLSecDSig
->
idKeys
=
array
(
'AssertionID'
);
$objXMLSecDSig
->
idKeys
=
array
(
'AssertionID'
);
...
@@ -114,7 +114,8 @@ MSG;
...
@@ -114,7 +114,8 @@ MSG;
array
(
'http://www.w3.org/2000/09/xmldsig#enveloped-signature'
,
XMLSecurityDSig
::
EXC_C14N
),
array
(
'http://www.w3.org/2000/09/xmldsig#enveloped-signature'
,
XMLSecurityDSig
::
EXC_C14N
),
array
(
'id_name'
=>
'AssertionID'
)
array
(
'id_name'
=>
'AssertionID'
)
);
);
$objKey
=
new
XMLSecurityKey
(
XMLSecurityKey
::
RSA_SHA1
,
array
(
'type'
=>
'private'
));
$objKey
=
new
XMLSecurityKey
(
$algo
,
array
(
'type'
=>
'private'
));
$objKey
->
loadKey
(
$key
,
true
);
$objKey
->
loadKey
(
$key
,
true
);
$objXMLSecDSig
->
sign
(
$objKey
);
$objXMLSecDSig
->
sign
(
$objKey
);
if
(
$cert
)
{
if
(
$cert
)
{
...
@@ -185,7 +186,22 @@ MSG;
...
@@ -185,7 +186,22 @@ MSG;
$privateKeyFile
=
\SimpleSAML\Utils\Config
::
getCertPath
(
$idpMetadata
->
getString
(
'privatekey'
));
$privateKeyFile
=
\SimpleSAML\Utils\Config
::
getCertPath
(
$idpMetadata
->
getString
(
'privatekey'
));
$certificateFile
=
\SimpleSAML\Utils\Config
::
getCertPath
(
$idpMetadata
->
getString
(
'certificate'
));
$certificateFile
=
\SimpleSAML\Utils\Config
::
getCertPath
(
$idpMetadata
->
getString
(
'certificate'
));
$wresult
=
sspmod_adfs_IdP_ADFS
::
signResponse
(
$response
,
$privateKeyFile
,
$certificateFile
);
$algo
=
$spMetadata
->
getString
(
'signature.algorithm'
,
null
);
if
(
$algo
===
null
)
{
/*
* In the NIST Special Publication 800-131A, SHA-1 became deprecated for generating
* new digital signatures in 2011, and will be explicitly disallowed starting the 1st
* of January, 2014. We'll keep this as a default for the next release and mark it
* as deprecated, as part of the transition to SHA-256.
*
* See http://csrc.nist.gov/publications/nistpubs/800-131A/sp800-131A.pdf for more info.
*
* TODO: change default to XMLSecurityKey::RSA_SHA256.
*/
$algo
=
$idpMetadata
->
getString
(
'signature.algorithm'
,
XMLSecurityKey
::
RSA_SHA1
);
}
$wresult
=
sspmod_adfs_IdP_ADFS
::
signResponse
(
$response
,
$privateKeyFile
,
$certificateFile
,
$algo
);
$wctx
=
$state
[
'adfs:wctx'
];
$wctx
=
$state
[
'adfs:wctx'
];
$wreply
=
$state
[
'adfs:wreply'
]
?
:
$spMetadata
->
getValue
(
'prp'
);
$wreply
=
$state
[
'adfs:wreply'
]
?
:
$spMetadata
->
getValue
(
'prp'
);
...
...
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