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

Remove lib/Saml and its references #566

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/php-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
php vendor/bin/pdepend --summary-xml=tests/build/logs/dependence-summary.xml --jdepend-chart=tests/build/dependences/jdepend.svg --overview-pyramid=tests/build/dependences/pyramid.svg lib/.

- name: PHP Code Sniffer
run: php vendor/bin/phpcs --standard=tests/ZendModStandard lib/Saml2 demo1 demo2 demo-old endpoints tests/src
run: php vendor/bin/phpcs --standard=tests/ZendModStandard lib/Saml2 demo1 demo2 endpoints tests/src

- name: Run unit tests
run: vendor/bin/phpunit --verbose --debug
114 changes: 0 additions & 114 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,6 @@ and settings file stored at `vendor/onelogin/php-saml`.

Your settings are at risk of being deleted when updating packages using `composer update` or similar commands. So it is **highly** recommended that instead of using settings files, you pass the settings as an array directly to the constructor (explained later in this document). If you do not use this approach your settings are at risk of being deleted when updating packages using `composer update` or similar commands.

Compatibility
-------------

This 2.0 version has a new library. The toolkit is still compatible.

The old code that you used in order to add SAML support will continue working
with minor changes. You only need to load the files of the `lib/Saml` folder.
(notice that the `compatibility.php` file do that).

The old-demo folder contains code from an old app that uses the old version of
the toolkit (v.1). Take a look.

Sometimes the names of the classes of the old code could be a bit different
and if that is your case you must change them for `OneLogin_Saml_Settings`,
`OneLogin_Saml_Response`, `OneLogin_Saml_AuthRequest` or `OneLogin_Saml_Metadata`.

We recommend that you migrate the old code to the new one to be able to use
the new features that the new library Saml2 carries.


Namespaces
----------
Expand Down Expand Up @@ -248,10 +229,6 @@ handle the sign and the encryption of xml elements.
#### `lib/` ####

This folder contains the heart of the toolkit, the libraries:

* `Saml` folder contains a modified version of the toolkit v.1 and allows the
old code to keep working. (This library is provided to maintain
backward compatibility).
* `Saml2` folder contains the new version of the classes and methods that
are described in a later section.

Expand Down Expand Up @@ -290,8 +267,6 @@ and support multiple languages.
advanced_settings.php file which contains extra configuration info related to
the security, the contact person, and the organization associated to the SP.
* `_toolkit_loader.php` - This file load the toolkit libraries (The SAML2 lib).
* `compatibility` - Import that file to make compatible your old code with the
new toolkit (loads the SAML library).


#### Miscellaneous ####
Expand All @@ -300,8 +275,6 @@ and support multiple languages.
* `demo1/` - Contains an example of a simple PHP app with SAML support.
Read the `Readme.txt` inside for more info.
* `demo2/` - Contains another example.
* `demo-old/` - Contains an example that uses the code of the older version of the
the toolkit to demonstrate the backwards compatibility.


### How it works ###
Expand Down Expand Up @@ -667,10 +640,6 @@ require_once(TOOLKIT_PATH . '_toolkit_loader.php');
After that line we will be able to use the classes (and their methods) of the
toolkit (because the external and the Saml2 libraries files are loaded).

If you wrote the code of your SAML app for the version 1 of the PHP-SAML toolkit
you will need to load the `compatibility.php`, file which loads the SAML library files,
in addition to the the `_toolkit_loader.php`.

That SAML library uses the new classes and methods of the latest version of the
toolkits but maintain the old classes, methods, and workflow of the old process
to accomplish the same things.
Expand Down Expand Up @@ -1299,48 +1268,6 @@ Get the ID of the last processed message/assertion with the `getLastMessageId/ge

Described below are the main classes and methods that can be invoked.

#### The Old Saml library ####

Lets start describing the classes and methods of the SAML library, an evolution
of the old v.1 toolkit that is provided to keep the backward compability.
Most of them use classes and methods of the new SAML2 library.

##### OneLogin_Saml_AuthRequest - `AuthRequest.php` #####

Has the protected attribute `$auth`, an `OneLogin_Saml2_Auth` object.

* `OneLogin_Saml_AuthRequest` - Constructs `OneLogin_Saml2_Auth`,
initializing the SP SAML instance.
* `getRedirectUrl($returnTo)` - Obtains the SSO URL containing the AuthRequest
message deflated.


##### OneLogin_Saml_Response - `Response.php` #####

* `OneLogin_Saml_Response` - Constructor that process the SAML Response,
Internally initializes an SP SAML instance and an `OneLogin_Saml2_Response`.
* `get_saml_attributes` - Retrieves an Array with the logged user data.


##### OneLogin_Saml_Settings - `Settings.php` #####

A simple class used to build the Setting object used in the v1.0 of the toolkit.

##### OneLogin_Saml_Metadata - `Metadata.php` #####

* `OneLogin_Saml_Metadata` - Constructor that build the Metadata XML info based
on the settings of the SP
* `getXml` - An XML with the metadata info of the SP


##### OneLogin_Saml_XmlSec - `XmlSec.php` #####

Auxiliary class that contains methods to validate the SAML Response:
`validateNumAssertions`, `validateTimestamps`, `isValid` (which
uses the other two previous methods and also validate the signature of
SAML Response).


#### Saml2 library ####

Lets describe now the classes and methods of the SAML2 library.
Expand Down Expand Up @@ -1701,44 +1628,3 @@ demo1, only changes the targets.
to the IdP (to the SLS endpoint of the IdP).The IdP receives the Logout
Response, process it and close the session at of the IdP. Notice that the
SLO Workflow starts and ends at the IdP.


## Demo Old ##

### SP setup ###

This demo uses the old style of the version 1 of the toolkit.
An object of the class `OneLogin_Saml_Settings` must be provided to the
constructor of the `AuthRequest`.

You will find an `example_settings.php` file at the demo-old's folder that
could be used as a template for your `settings.php` file.

In that template, SAML settings are divided into two parts, the application
specific (`const_assertion_consumer_service_url`, `const_issuer`,
`const_name_identifier_format`) and the user/account specific
`idp_sso_target_url`, `x509certificate`). You'll need to add your own code here
to identify the user or user origin (e.g. by `subdomain`, `ip_address` etc.).


### IdP setup ###

Once the SP is configured, the metadata of the SP is published at the
`metadata.php` file. After that, configure the IdP based on that information.


### How it works ###

At the `metadata.php` view is published the metadata of the SP.

The `index.php` file acts as an initiater for the SAML conversation if it should
should be initiated by the application. This is called Service Provider
Initiated SAML. The service provider creates a SAML Authentication Request and
sends it to the identity provider (IdP).

The `consume.php` is the ACS endpoint. Receives the SAML assertion. After Response
validation, the userdata and the nameID will be available, using `getNameId()` or
`getAttributes()` we obtain them.

Since the version 1 of the php toolkit does not support SLO we don't show how
handle SLO in this demo-old.
12 changes: 0 additions & 12 deletions compatibility.php

This file was deleted.

1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"autoload": {
"classmap": [
"extlib/xmlseclibs",
"lib/Saml",
"lib/Saml2"
]
},
Expand Down
43 changes: 0 additions & 43 deletions demo-old/Readme.txt

This file was deleted.

37 changes: 0 additions & 37 deletions demo-old/consume.php

This file was deleted.

19 changes: 0 additions & 19 deletions demo-old/index.php

This file was deleted.

15 changes: 0 additions & 15 deletions demo-old/metadata.php

This file was deleted.

54 changes: 0 additions & 54 deletions demo-old/settings_example.php

This file was deleted.

Loading