Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Lightsaml Laravel Package

aerialship/lightsaml

SAML 2.0 toolkit for Laravel/PHP to add SSO and identity federation to your apps. Provides helpers for SAML authentication flows, metadata, and certificate handling, making it easier to integrate with common IdPs and SPs.

View on GitHub
Deep Wiki
Context7

METADATA

Metadata building

Use aerialship:lightsaml:sp:meta:build command for simple cases

$ed = new EntityDescriptor();
$sp = new SpSsoDescriptor();
$ed->addItem($sp);

// KeyDescriptor
$certificate = new X509Certificate();
$certificate->loadFromFile($certificatePath);
$keyDescriptor = new KeyDescriptor('signing', $certificate);
$ed->addItem($keyDescriptor);

// SingleLogoutService
$s = new SingleLogoutService();
$s->setLocation($url);
$s->setBinding($this->resolveBinding($binding));
$sp->addService($s);

// AssertionConsumerService
$s = new AssertionConsumerService($binding1, $url, 0);
$sp->addService($s);
$s = new AssertionConsumerService($binding2, $url, 1);
$sp->addService($s);

Saving metadata to xml

$ed = new Model\Metadata\EntityDescriptor();
// ...
$context = new Meta\SerializationContext();
$ed->getXml($context->getDocument(), $context);
file_put_contents($context->getDocument()->saveXML(), $xml);

Loading metadata from xml

$doc = new \DOMDocument();
$doc->load('sp.xml');
$ed = new EntityDescriptor();
$ed->loadFromXml($doc->firstChild);

AUTHN REQUEST

$spMeta = new Meta\SpMeta();
$spMeta->setNameIdFormat(NameIDPolicy::PERSISTENT);
$spED = getEntityDescriptorSP();
$idpED = getEntityDescriptorIDP();

$builder = new Meta\AuthnRequestBuilder($spED, $idpED, $spMeta);
$request = $builder->build();

SENDING MESSAGE

HTTP Redirect

$binding = new Binding\HttpRedirect();
$bindingResponse = $binding->send($message);
$bindingResponse->render();

HTTP POST

$binding = new Binding\HttpPost();
$bindingResponse = $binding->send($message);
$bindingResponse->render();

RECEIVING MESSAGE

$request = new Binding\Request();
$request->setQueryString($_SERVER['QUERY_STRING']);
$request->setGet($_GET);
$request->getPost($_POST);
$request->setRequestMethod($_SERVER['REQUEST_METHOD']);

$detector = new BindingDetector();
$binding = $detector->instantiate($this->bindingDetector->getBinding($bindingRequest));

$message = $binding->receive($bindingRequest);
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
symfony/ai-symfony-mate-extension
aashan/pimcore-mcp-bundle
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin