I want to integrate SAML2 in Laravel application.
I don't want to use the third party IDP and SP.
I simply want to use Laravel authentication system + SAML2.
Anyone idea about it?
Please share any reference link or suggestions.
Thanks in advance.
Follow these steps.
Make these changes to composer.json:
{
"require": {
"aacotroneo/laravel-saml2": "dev-remove_mcrypt",
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/thomhickey/laravel-saml2"
}
],
"minimum-stability": "dev",
}
Then run: composer update
If you need more info head over to: https://github.com/aacotroneo/laravel-saml2/issues/122
It's not good idea to reinvent the wheel. I recommend you should use
https://github.com/aacotroneo/laravel-saml2
package.
In case you need, this SO answer might be helpful
https://stackoverflow.com/a/62331871/8621306
Related
I'm trying to add this SDK in my Laravel 5.4 application. I downloaded and installed it in app/resources/assets and guessing that I can use it in controllers as:
require_once '[ruta/payu-php-sdk]/lib/PayU.php';
The SDK have some Eviromental variables and Keys.
What do you think is the better approach for this type of SDK in laravel?
I'd suggest using Omnipay, it's a well supported library the has integrations for many different gateways, including PayU. This library is framework agnostic, so you won't need to change your code should you need to change payment gateways.
You can use composer to add these libraries:
"require": {
"omnipay/omnipay": "~2.0",
"omnipay/payu": "~2.0"
}
This way you don't have to keep track of requires.
Edit: To add any type of library that doesn't use composer already, You could manually tell composer to autoload file(s).
For your case, there should be a section in your composer.json called autoload, here's what you could add:
...
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
},
"files": [
"ruta/payu-php-sdk/lib/PayU.php"
]
},
...
This should make the SDK available throughout the application.
I'm using Laravel 5.1, and I'm thinking of a way to create a plan without going to my Stripe account.
I used:
composer require stripe/stripe-php 2.*
Then I did this in my controller:
use \Stripe\Plan;
Plan::create(array(
"amount" => 2000,
"interval" => "monthly",
"name" => "Amazing Gold Plan",
"currency" => "usd",
"id" => "gold")
);
And got the following error:
Class 'Stripe\Plan' not found
Am I doing something wrong? Thanks in advance if you know what to do.
The problem it seems like your Strip class is not being loaded, I review the documentation and the library is a PHP library not a Laravel package
You could load it on the Autoload section on the composer.json but if you are already using Laravel I really recommend you to use Laravel Cashier and simply follow the steps of the documentation
https://laravel.com/docs/5.4/billing
It should be something like this... I recommend you to check the composer documentation
"autoload": {
"psr-4": {
"App\\": "app/",
"Stripe\\": "vendor/your/stripe/path",
},
}
We added PHPExcel to composer by adding the following
To repositories:
{
"type": "package",
"package": {
"name": "PHPOffice/PHPExcel",
"version": "1.9",
"source": {
"url": "https://github.com/PHPOffice/PHPExcel.git",
"type": "git",
"reference": "1.9"
},
"autoload": {
"psr-0": {
"PHPExcel": "src/"
}
}
}
To require:
"PHPOffice/PHPExcel": "1.9.*"
In our code:
use PHPExcel\IOFactory;
...
$file = $request->get('file');
$inputFileType = IOFactory::identify($file);
The error we get is:
Attempted to load class "IOFactory" from namespace "PHPExcel".
Did you forget a "use" statement for another namespace?
The namespace looks right (https://github.com/PHPOffice/PHPExcel/blob/1.9/src/PhpSpreadsheet/IOFactory.php).
Use of the 1.9 branch is not recommended. It isn't completely converted yet to use namespaces, and is subject to significant code change. Nor is it backward compatible with the official 1.8 branch, and the changes are not yet documented, and also subject to further major changes as we modify the code to take advantage of the newer features of PHP.
The official release branch is still 1.8
Just because the 1.8 branch exists on github, doesn't mean that it's working code. I store it there so that it's available for shared development, and as a security (rather than keeping it all on my development laptop) in case I get run over by a bus tomorrow.
I have not used 1.9. Glad to see that they are moving to namespaces. That said, you might be better off sticking with 1.8 just for stability.
In any event, 1.9 relies on psr-4. Try adding this to your composer.json file:
"autoload": {
"psr-4": {
"PHPExcel\\": "src/PhpSpreadsheet"
}
}
Then rebuilding the composer generated autoload.php file.
guys!
I simply want to clone repository via composer. But unfortunately - i can't.
My composer.json looks like:
{
"repositories": [
{
"type": "vcs",
"url": "https://bitbucket.org/yuriikrevnyi/bitrix-teil-framework"
}
],
"require": {
"mockery/mockery": "dev-master#dev",
"phpunit/phpunit": "3.7.*"
}
}
But its not going to work.
So, couldnt you help me a little bit?
And there is one more question. How to 'clone' private repo with composer? Lets say, we have same repo - https://bitbucket.org/yuriikrevnyi/bitrix-teil-framework. And admin password is - PASSWORD
So, how the composer.json should look now?
Thanks!
The respositories section is only to define packages that are not present in the packagist.org database, but it is present on a 'source control'.
So, it is like you tell composer in your composer.json that there is a package which is source controlled, and here are the details where you get it from, by defining url .. etc.
But that is not enough, because that is only definition and not consuming (downloading) the package. In order to do so, you need to add it to your require section as well.
{
"repositories": [
{
"type": "vcs",
"url": "https://bitbucket.org/yuriikrevnyi/bitrix-teil-framework"
}
],
"require": {
"mockery/mockery": "dev-master#dev",
"phpunit/phpunit": "3.7.*",
"yuriikrevnyi/bitrix-teil-framework": "*"
}
}
In your posted composer.json you are stating multiple facts.
You state that the software this composer.json belongs to requires the packages named "mockery/mockery" and "phpunit/phpunit".
You also state that there is some repository existing that might contain some software.
What you are not stating is that Composer should clone that repository - and you cannot do this with Composer. Composer will by default only know about packages registered at packagist.org, and additionally will look into any declared repository to see which software is in there in case that software is required.
So without having another composer.json in that repository hosted at Bitbucket, nothing will happen. Also, without requiring the software that is hosted there, nothing will happen.
Your problem description is missing the most important parts to help ypu better:
Describe what you were doing.
Describe the expected result.
Describe the actual result and how it differs from the expected result.
What you are describing is roughly point 1 (could have more details), your words "it does not work" fails to describe point 3, and point 2 is missing alltogether.
How i can add adLDAP library to LARAVEL 4 ?
http://adldap.sourceforge.net/
That library does not offer a composer.json file yet, you you have to create the necessary information yourself.
I have created a sample file that successfully downloaded something that looks good, but I haven't used the code.
{
"require": {
"adldap/adldap": "4.0.4"
},
"repositories" : [
{
"type": "package",
"package": {
"name" : "adldap/adldap",
"version": "4.0.4",
"dist": {
"url": "http://sourceforge.net/projects/adldap/files/adLDAP/adLDAP_4.0.4/adLDAP_4.0.4r2.zip/download",
"type": "zip"
},
"source": {
"url":"https://svn.code.sf.net/p/adldap/code/",
"type": "svn",
"reference": "tags/v4.0.4/"
},
"autoload": {
"classmap": ["src/"]
}
}
}
]
}
You'd have to create one repositories entry per version you are about to use (one entry is enough if you don't plan do something fancy). I created the entry for the most recent version 4.0.4 - if there is an update, you have to change the version tags everywhere.
The require entry should be added to whatever you are already using.
The distribution URL is a rough guess by following the download link to the ZIP file offered on Sourceforge, bypassing any ad-filled download page. It might stop working unexpectedly. If you delete the whole dist section, you will checkout from the original SVN repository instead, which might be slower than downloading and unpacking a ZIP file.
After that, you are all set with the Composer part. The remaining thing is to include Composer autoloading in the Laravel bootstrapping (you might already have that done), and then enjoy the LDAP classes.
Anyone coming across this in the future, adLDAP has a composer file now and can easily be autoloaded.
"require": {
"adldap/adldap": "4.0.*"
},
Then load the library in your controller:
$ldap = new \adLDAP\adLDAP($config);