Giter VIP home page Giter VIP logo

lightsaml.github.io's Introduction

⚠️ This library is no longer actively developed. ⚠️

We recommend our new repository litesaml/lightsaml.

No need to change your code just update composer.json.

     "require": {
-        "lightsaml/lightsaml": "~2.3.4",
+        "litesaml/lightsaml": "~3.0.0",
     },

SAML 2.0 PHP Library

GitHub release Software License Run tests Coverage Status Scrutinizer Packagist Version

LightSaml Implements basic SAML 2.0 data model classes, serialization/deserialization to/from xml with XML security and certificates support, and message encapsulations to bindings. Covered with unit tests.

DOCUMENTATION

CONTRIBUTING

LightSaml is an open source project and is open for contributions.

lightsaml.github.io's People

Contributors

bernardosilva avatar tmilos avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lightsaml.github.io's Issues

Assertion node label difference

Hello. This may not be the place to ask, but I am really stuck.

One thing I noticed is that the assertion in my response has a different node label than the examples I've been given and the examples in the LightSAML cookbook.

Mine... "<Assertion..."
All others... "<saml:Assertion..."

I am including the code I am using to generate the response in case there is something wrong there. Thanks for any and all help!

`$certificate = \LightSaml\Credential\X509Certificate::fromFile( path to file );
$privateKey = \LightSaml\Credential\KeyHelper::createPrivateKey( path to file, '', true );

				$response_id = \LightSaml\Helper::generateID();
				
				$response = new \LightSaml\Model\Protocol\Response();
				$response
				    ->addAssertion( $assertion = new \LightSaml\Model\Assertion\Assertion() )
				    ->setStatus( new \LightSaml\Model\Protocol\Status(
				        new \LightSaml\Model\Protocol\StatusCode(
				            \LightSaml\SamlConstants::STATUS_SUCCESS )
				        )
				    )
				    ->setID( $response_id )
				    ->setIssueInstant( new \DateTime() )
				    ->setDestination( $destination )
				    ->setIssuer( new \LightSaml\Model\Assertion\Issuer( $carrier_id ) )
				    ->setSignature(new \LightSaml\Model\XmlDSig\SignatureWriter( $certificate, $privateKey ));
					
				$assertion_id = \LightSaml\Helper::generateID();
				
				$assertion
				    ->setId( $assertion_id )
				    ->setIssueInstant(new \DateTime())
				    ->setIssuer(new \LightSaml\Model\Assertion\Issuer( $carrier_id ))
				    ->setSubject(
				        (new \LightSaml\Model\Assertion\Subject())
				            ->setNameID(new \LightSaml\Model\Assertion\NameID(
				                $user->email,
				                \LightSaml\SamlConstants::NAME_ID_FORMAT_UNSPECIFIED
				            ))
				            ->addSubjectConfirmation(
				                (new \LightSaml\Model\Assertion\SubjectConfirmation())
				                    ->setMethod(\LightSaml\SamlConstants::CONFIRMATION_METHOD_BEARER)
				                    ->setSubjectConfirmationData(
				                        (new \LightSaml\Model\Assertion\SubjectConfirmationData())
				                            ->setNotOnOrAfter(new \DateTime('+1 MINUTE'))
				                            ->setRecipient( $destination )
				                    )
				            )
				    )
				    ->setConditions(
				        (new \LightSaml\Model\Assertion\Conditions())
				            ->setNotBefore(new \DateTime())
				            ->setNotOnOrAfter(new \DateTime('+1 MINUTE'))
				            ->addItem(
				                new \LightSaml\Model\Assertion\AudienceRestriction( [$audience] )
				            )
				    )
				    ->addItem(
				        (new \LightSaml\Model\Assertion\AttributeStatement())
				            ->addAttribute(new \LightSaml\Model\Assertion\Attribute(
				                'Groups',
				                '01945-UsersGroup'
				            ))
				            ->addAttribute(new \LightSaml\Model\Assertion\Attribute(
				                'Action',
				                'CREATE'
				            ))
				            ->addAttribute(new \LightSaml\Model\Assertion\Attribute(
				                'AppliationData'
				            ))
				            ->addAttribute(new \LightSaml\Model\Assertion\Attribute(
				                'ChannelName',
				                'WIA'
				            ))
				            ->addAttribute(new \LightSaml\Model\Assertion\Attribute(
				                'CompanyIdentifier',
				                '1945'
				            ))
				            ->addAttribute(new \LightSaml\Model\Assertion\Attribute(
				                'TimeoutURL'
				            ))
				    )
				    ->addItem(
				        ( new \LightSaml\Model\Assertion\AuthnStatement())
				            ->setAuthnInstant(new \DateTime('-10 MINUTE'))
				            ->setSessionIndex( $assertion_id )
				            ->setAuthnContext(
				                (new \LightSaml\Model\Assertion\AuthnContext())
				                    ->setAuthnContextClassRef(\LightSaml\SamlConstants::AUTHN_CONTEXT_UNSPECIFIED)
				            )
				    );
				$bindingFactory	= new \LightSaml\Binding\BindingFactory();
				$postBinding	= $bindingFactory->create(\LightSaml\SamlConstants::BINDING_SAML2_HTTP_POST);
				
				$messageContext	= new \LightSaml\Context\Profile\MessageContext();
				$messageContext->setMessage( $response )->asResponse();
				
				
				$httpResponse = $postBinding->send( $messageContext );
				print $httpResponse->getContent();

`

Symfony 2.8 security setup with LightSamlPhp Bundle - Multiple Login Methods

Hi, I am running into an issue with setting up Authentication in Symfony 2.8 with Saml plugin (https://www.lightsaml.com/SP-Bundle/Getting-started/).
Problem:
I want to able to login via SAML and via going to admin page. The /admin/login page works fine, I see the user authenticated from the database. However, when I try to go through the Saml process, I always land on the /discovery page. When I see the logs, I do user is authenticated. So, I think I have something not correctly in security settings. Please let me know if you can help

Here are the settings from

config/security.yml file:

firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false

    login_firewall:
        pattern: ^/saml/login$
        anonymous: ~
    discovery_firewall:
        pattern: ^/saml/discovery$
        anonymous: ~

    secured_area:
        pattern:   ^/
        anonymous: ~
        light_saml_sp:
            provider: db_provider    # user provider name configured in step 9
            #user_creator: user_creator  # name of the user creator service created in step 10
            login_path: /saml/login
            check_path: /saml/login_check
            default_target_path: /profile

        form_login:
            login_path: /admin/login
            check_path: /admin/login_check
            default_target_path: /
            remember_me: true
        logout:
            path:   /logout
            target: /


        # activate different ways to authenticate

        # http_basic: ~
        # http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate

        # form_login: ~
        # http://symfony.com/doc/current/cookbook/security/form_login_setup.html

access_control:
    - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/admin/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }        
    - { path: ^/profile, roles: ROLE_USER }

[question] SAML2 Authentication client side

Hey Guys,
i would like to ask, is there on this package just a server implementation or a client implementation, too?
When there is a client implementantion, too. Could anyone respond on it and explain how it would like to implement for it a solution on? I mean. Yes i saw, that there is a way to let a user authenticate, would it also be possible to authenticate a user without posting or redirect him or her, by passing serverside a authorization ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.