Download the PHP package curio/sdclient without Composer

On this page you can find all versions of the php package curio/sdclient. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sdclient

🔑 SD Client

A Laravel package for use with the 🔐 sdlogin OpenID connect server.

🚀 Using this package

[!WARNING] Please make sure your app is using https, to prevent unwanted exposure of token, secrets, etc.

To use sdclient in your project:

  1. In your laravel project run: composer require curio/sdclient

  2. Set these keys in your .env file:

    • SD_CLIENT_ID
    • SD_CLIENT_SECRET
    • SD_API_LOG (optional)
      • Default: no
      • Set to yes to make SdClient log all usage of access_tokens and refresh_tokens to the default log-channel.
    • SD_APP_FOR (optional)
      • Default: teachers
      • This key determines if students can login to your application.
      • May be one of:
    • all: everyone can login, you may restrict access using guards or middleware.
    • teachers: a student will be completely blocked and no user will be created when they try to login.
    • SD_USE_MIGRATION (optional)
      • Default: yes
      • Set to no if you want to use your own migration instead of the users migration this package provides
    • SD_SSL_VERIFYPEER (optional)
      • Default: yes
      • Set to no if you want to disable SSL verification. This is only recommended for during development and only on trusted networks.
  3. Alter your User model and add the line: public $incrementing = false;

  4. (Recommended) Remove any default users-migration from your app, because SdClient will conflict with it. Do not remove the user-model. If you want to keep using your own migration, in your .env file set: SD_USE_MIGRATION=no.

    Note that (unlike default user migrations) SD users have a string as their primary key. Any foreign keys pointing to the users table should also be of type string.

  5. Lastly, run php artisan migrate.

Read the required implementations below to see how to redirect your users to the login-server and how to catch the after-login redirect.

🔨 Required implementations

[!NOTE] SdClient is not compatible in combination with Laravel's make:auth command.

1️⃣ Letting your users login

Redirect your users to http://yoursite/sdclient/redirect. From here sdclient will send your user to sdlogin for authentication.

Example:

Implement a named route that will serve your users with a button or direct redirect to /sdclient/redirect.:

2️⃣ Catch the after-login redirect

The sdlogin server will ask the user if they want to allow your application to access their data. After the user has made their choice, they will be redirected to the /sdclient/ready or /sdclient/error route in your application.

Handling success (/sdclient/ready)

After confirming a successful login with sdlogin, the sdclient package will redirect you to /sdclient/ready.

Example:

Define a route in your applications routes/web.php file to handle this:

Handling errors (/sdclient/error)

If the user denies access to your application, or if something else goes wrong, the user will be redirected to /sdclient/error. The error and error_description will be stored in the session (as sdclient.error and sdclient.error_description respectively).

Example:

Define a route in your applications routes/web.php file to handle this:

3️⃣ Logging out

Send your user to /sdclient/logout.

[!NOTE] A real logout cannot be accomplished at this time. If you log-out of your app, but are still logged-in to the sdlogin-server, this will have no effect. This is because the sdlogin-server is a single-sign-on server, and is designed to keep you logged in to all applications that use it.

📈 SdApi

Apart from being the central login-server, login.amo.rocks also exposes an api. Please note this api is currently undocumented, although there are options to explore the api:

SdClient API Interface

An example of calling the api through SdClient:

Known 'bug': Currently the SdApi class doesn't check if the token expired but just refreshes it anytime you use it.

SdApi::get($endpoint)

👷‍♀️ Contributing

We welcome contributions from the community. Please see the contributing guide for more information.


All versions of sdclient with dependencies

PHP Build Version
Package Version
Requires lcobucci/jwt Version 4.0.4
guzzlehttp/guzzle Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package curio/sdclient contains the following files

Loading the files please wait ....