-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PSR-2 fix for ADFS module #481
Conversation
Thanks a lot @tvdijen! #458 is basically a reminder to keep track of what we need to do, but that doesn't mean we need to make all white spaces in the project compliant with PSR-2 at the same time, in the same commit. Actually, I think it's better if we do that slowly, file by file. So I would say that's something you can address here too, and then we won't have files that are PSR-2 compliant except for the whitespace. You could probably squash the existing commits, and then add another one changing tabs for spaces. Does that sound reasonable? |
Sure, I can fix the whitespace too.. I just don't have any clue on how to squash these commits. Is that even possible with this online GitHub-interface? |
Great! I'm not sure you can squash them through the web interface yourself, as I think that's only for those with rights to merge the PR, but you can always do that in the command line. |
That's, I'll check that out at a later time and then add a commit to fix whitespace too! |
I think I screwed up.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work @tvdijen!
I left some comments on the code. Don't worry about the squashing, that's something we can do easily (I think!)
modules/adfs/lib/IdP/ADFS.php
Outdated
$sessionLostURL = NULL; // TODO? | ||
$forceAuthn = FALSE; | ||
$isPassive = FALSE; | ||
//$sessionLostURL = NULL; // TODO? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a typo, or the variable is indeed unused?
If the latter, I would just get rid of it and if we need to mark something to do, leave just a comment, no code...
modules/adfs/lib/IdP/ADFS.php
Outdated
exit; | ||
public static function adfsPostResponse($url, $wresult, $wctx) | ||
{ | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change this with a call to echo
or a heredoc?
modules/adfs/lib/IdP/ADFS.php
Outdated
@@ -43,54 +45,62 @@ public static function receiveAuthnRequest(SimpleSAML_IdP $idp) { | |||
$idp->handleAuthenticationRequest($state); | |||
} | |||
|
|||
public static function ADFS_GenerateResponse($issuer, $target, $nameid, $attributes) { | |||
public static function adfsGenerateResponse($issuer, $target, $nameid, $attributes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the function is only used in this module, then it's ok to rename it. But in that case, I would take the chance to drop the adfs in front, since it's kind of redundant...
On the other hand, such change could probably be part of another PR, if this is only focused on PSR-2 compliance.
/** | ||
* Add this endpoint to an XML element. | ||
* | ||
* @param DOMElement $parent The element we should append this endpoint to. | ||
* @param string $name The name of the element we should create. | ||
*/ | ||
public static function appendXML(DOMElement $parent, $name, $address) { | ||
public static function appendXML(DOMElement $parent, $name, $address) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there's an extra space before the {
?
assert('is_string($name)'); | ||
assert('is_string($address)'); | ||
|
||
$e = $parent->ownerDocument->createElement($name); | ||
$parent->appendChild($e); | ||
$parent->appendChild($e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here and in the next change, looks like something is odd with indentation. Maybe the rest of the code is indented wrong?
modules/adfs/www/idp/prp.php
Outdated
@@ -23,6 +23,6 @@ | |||
// logout response from ADFS SP | |||
$assocId = $_GET['assocId']; // Association ID of the SP that sent the logout response | |||
$relayState = $_GET['relayState']; // Data that was sent in the logout request to the SP. Can be null | |||
$logoutError = NULL; /* NULL on success, or an instance of a SimpleSAML_Error_Exception on failure. */ | |||
$logoutError = null; /* NULL on success, or an instance of a SimpleSAML_Error_Exception on failure. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would update the comment too (s/NULL/null/). In general, I also prefer single-line comment markers (//
) for single-line comments, and multi-line comment markers (/* */
) for multi-line comments, but that's more personal preference and you don't have to do that if you don't want to 😄
Anything else @jaimeperez ? |
Thanks a lot Tim! Looks good to me 👍 There's only one thing I've just realized. Since some of the methods are changing their names and they are declared public, refactoring them could break other code. Have you checked that those functions are not used elsewhere? The simplest solution would be to add again the old methods as wrappers of the renamed ones, and mark them as deprecated in the phpdoc block, but it might not be worth the trouble if they are so specific that nobody should use them. |
I did a grep and the functions are only being used within the ADFS.php file. |
Sounds great, thanks so much Tim! |
Any update @tvdijen? |
No, unfortunately I haven't found the time to run the test.. |
Would be great, since I don't have a test environment for this stuff. |
I wonder if this module ever worked at all.. I can't even get a working setup without this PR :( |
I am using the ADFS module from 1.14.3, first without modifications, now with modifications from PR #469, so it did work! |
That's great news @pgh70! Since you have a working environment, would you be willing to perform another test after I convert some functions from public to private? |
@pgh70 Can you test Tim's latest changes? Thanks! |
e8859bb
to
b97f61d
Compare
d41a0fe
to
815a58a
Compare
This works like a charm! |
I intentionally skipped whitespace-fixes, since there's a separate issue 458 for that.