Skip to content
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

Merged
merged 3 commits into from
Aug 19, 2017
Merged

PSR-2 fix for ADFS module #481

merged 3 commits into from
Aug 19, 2017

Conversation

tvdijen
Copy link
Member

@tvdijen tvdijen commented Sep 28, 2016

I intentionally skipped whitespace-fixes, since there's a separate issue 458 for that.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 19.696% when pulling 281c936 on tvdijen:patch-5 into 644b05a on simplesamlphp:master.

@jaimeperez
Copy link
Member

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?

@tvdijen
Copy link
Member Author

tvdijen commented Sep 29, 2016

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?

@jaimeperez
Copy link
Member

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.

@tvdijen
Copy link
Member Author

tvdijen commented Sep 29, 2016

That's, I'll check that out at a later time and then add a commit to fix whitespace too!

@tvdijen
Copy link
Member Author

tvdijen commented Sep 29, 2016

I think I screwed up..

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 19.802% when pulling 74975c4 on tvdijen:patch-5 into 644b05a on simplesamlphp:master.

Copy link
Member

@jaimeperez jaimeperez left a 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!)

$sessionLostURL = NULL; // TODO?
$forceAuthn = FALSE;
$isPassive = FALSE;
//$sessionLostURL = NULL; // TODO?
Copy link
Member

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...

exit;
public static function adfsPostResponse($url, $wresult, $wctx)
{
print
Copy link
Member

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?

@@ -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)
Copy link
Member

@jaimeperez jaimeperez Oct 11, 2016

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)
{
Copy link
Member

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);
Copy link
Member

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?

@@ -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. */
Copy link
Member

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 😄

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 20.213% when pulling eed9afd on tvdijen:patch-5 into 644b05a on simplesamlphp:master.

@tvdijen
Copy link
Member Author

tvdijen commented Oct 17, 2016

Anything else @jaimeperez ?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 20.213% when pulling a7e206e on tvdijen:patch-5 into 644b05a on simplesamlphp:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 20.213% when pulling b5fb3c0 on tvdijen:patch-5 into 644b05a on simplesamlphp:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 20.213% when pulling b5fb3c0 on tvdijen:patch-5 into 644b05a on simplesamlphp:master.

@jaimeperez
Copy link
Member

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.

@tvdijen
Copy link
Member Author

tvdijen commented Oct 24, 2016

I did a grep and the functions are only being used within the ADFS.php file.
Could probably make them private too.. I happen to have an ADFS machine available, so I can run a quick test if nothing breaks.. I'll get back to you on this.

@jaimeperez
Copy link
Member

Sounds great, thanks so much Tim!

@thijskh
Copy link
Member

thijskh commented Nov 14, 2016

Any update @tvdijen?

@tvdijen
Copy link
Member Author

tvdijen commented Nov 14, 2016

No, unfortunately I haven't found the time to run the test..
I'll see if I can fit it in somewhere this week, since I will be abroad for the next two weeks..

@thijskh
Copy link
Member

thijskh commented Nov 14, 2016

Would be great, since I don't have a test environment for this stuff.

@tvdijen
Copy link
Member Author

tvdijen commented Nov 16, 2016

I wonder if this module ever worked at all.. I can't even get a working setup without this PR :(
I'm running into a 'Missing AuthState parameter' after logging in ...

@pgh70
Copy link

pgh70 commented Dec 13, 2016

I am using the ADFS module from 1.14.3, first without modifications, now with modifications from PR #469, so it did work!

@tvdijen
Copy link
Member Author

tvdijen commented Dec 13, 2016

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?

@thijskh
Copy link
Member

thijskh commented Jan 30, 2017

@pgh70 Can you test Tim's latest changes? Thanks!

@tvdijen tvdijen force-pushed the patch-5 branch 2 times, most recently from e8859bb to b97f61d Compare July 29, 2017 13:27
@tvdijen tvdijen mentioned this pull request Aug 18, 2017
@tvdijen tvdijen force-pushed the patch-5 branch 4 times, most recently from d41a0fe to 815a58a Compare August 18, 2017 21:21
@tvdijen
Copy link
Member Author

tvdijen commented Aug 18, 2017

This works like a charm!

@thijskh thijskh merged commit 133fd05 into simplesamlphp:master Aug 19, 2017
@tvdijen tvdijen deleted the patch-5 branch August 19, 2017 09:10
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants