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

The receive method does not return anything #1

Open
cjhaas opened this issue Jan 14, 2023 · 4 comments
Open

The receive method does not return anything #1

cjhaas opened this issue Jan 14, 2023 · 4 comments

Comments

@cjhaas
Copy link

cjhaas commented Jan 14, 2023

The documentation says that receive will return various things, however it appears that this is not true, and you should instead call getMessage() on the MessageContext that was previously created.

$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();

$bindingFactory = new \LightSaml\Binding\BindingFactory();
$binding = $bindingFactory->getBindingByRequest($request);

$messageContext = new \LightSaml\Context\Profile\MessageContext();
$binding->receive($request, $messageContext);

if($message = $messageContext->getMessage()){
	print $message->getID();
}
@william-suppo
Copy link
Contributor

Hello @cjhaas,

Thanks you for your issue, I will investigate ASAP.

Bye

@abublihi
Copy link

Same thing for me, receive dose not return any thing, also the documentation dose not describe how to receive an encrypted message.

@william-suppo thanks for the awesome simple package

@abublihi
Copy link

i have resolved the issue by using the messageContext

        $request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();

        $bindingFactory = new \LightSaml\Binding\BindingFactory();
        $binding = $bindingFactory->getBindingByRequest($request);

        $messageContext = new \LightSaml\Context\Profile\MessageContext();
        $binding->receive($request, $messageContext);

        $messageContext->getMessage()->getId();

@PedroRibeiroEkinops
Copy link

PedroRibeiroEkinops commented Feb 16, 2024

If you want to get response as expected from receive function:

$response = $messageContext->asResponse();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants