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

Allow core:PHP to manipulate the whole $request/$state #655

Closed
pradtke opened this Issue Jul 19, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@pradtke
Contributor

pradtke commented Jul 19, 2017

Based on https://groups.google.com/forum/#!topic/simplesamlphp-dev/PDENkRUnfA8

Patrick:

There are frequent requests on the mailing list to be able to override certain service provider metadata settings. When that metadata comes from metarefresh it is not easily achievable.

One option may be to make core:PHP more versatile and let it adjust the entire $request, not just just the attributes array.

For example if it has access to the $request/$state you could do something like:

10 => array(
    'class' => 'core:PHP',
    'code' => '
        switch ($request["Destination"]["entityid"]) {
            case "https://entity1":
                // Add to existing required attributes
                $request["Destination"]["attributes"][] = "extra-required-attribute";
                break;
            case "https://something-else":
                // Replace existing required attributes
                $request["Destination"]["attributes"] = ["name","favorite_sandwhich"];
                break;
         }
    ',
    ),

I suppose the obvious downside is that it is easy to typo things in the code block, and people may start doing other weird things to the internal state that becomes hard to support.

Anyhow, I'm curious what other people think.

Jaime:
Do you mind opening an issue in Github for this?

In any case, I see the benefit of this and we could even pass more information to the function. This could be a nice addition to motivate people to use a callback instead of the (soon to be deprecated) “code” option of the filter :-)

pradtke added a commit to pradtke/simplesamlphp that referenced this issue Sep 27, 2018

thijskh added a commit that referenced this issue Oct 13, 2018

Merge pull request #942 from pradtke/655/php-edit-state
#655 allow core:php to manipulate all of the state

@thijskh thijskh closed this Oct 13, 2018

@thijskh thijskh added this to the 1.17 milestone Oct 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment