silverstripe / realme
Adds support to SilverStripe for authentication via RealMe (https://www.realme.govt.nz/)
Installs: 100 115
Dependents: 2
Suggesters: 0
Security: 0
Stars: 9
Watchers: 13
Forks: 24
Type:silverstripe-vendormodule
Requires
- php: ^8.3
- onelogin/php-saml: ^4
- silverstripe/framework: ^6
Requires (Dev)
- 6.x-dev
- 6.0.x-dev
- 6.0.0-alpha1
- 5.x-dev
- 5.4.x-dev
- 5.4.0
- 5.4.0-rc1
- 5.4.0-beta1
- 5.3.x-dev
- 5.3.2
- 5.3.1
- 5.3.0
- 5.3.0-rc1
- 5.3.0-beta1
- 5.2.x-dev
- 5.2.1
- 5.2.0
- 5.2.0-rc1
- 5.2.0-beta1
- 5.1.x-dev
- 5.1.2
- 5.1.1
- 5.1.0
- 5.0.x-dev
- 5.0.2
- 5.0.1
- 5.0.0
- 5.0.0-rc1
- 5.0.0-beta1
- 4.x-dev
- 4.5.x-dev
- 4.5.3
- 4.5.2
- 4.5.1
- 4.5.0
- 4.5.0-beta1
- 4.4.x-dev
- 4.4.6
- 4.4.5
- 4.4.4
- 4.4.3
- 4.4.2
- 4.4.1
- 4.4.0
- 4.4.0-rc1
- 4.4.0-beta1
- 4.3.x-dev
- 4.3.0
- 4.3.0-rc1
- 4.3.0-beta1
- 4.2.x-dev
- 4.2.0
- 4.2.0-rc1
- 4.2.0-beta1
- 4.1.x-dev
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1.0
- 4.1.0-rc1
- 4.0.x-dev
- 4.0.2
- 4.0.1
- 4.0.0
- 3.x-dev
- 3.1.x-dev
- 3.1.5
- 3.1.4
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.x-dev
- 3.0.0
- 3.0.0-rc1
- 2.x-dev
- 2.1.1
- 2.1.0
- 2.1.0-rc2
- 2.1.0-rc1
- 2.0.x-dev
- 2.0.1
- 2.0.0
- 0.9.1
- 0.9.0
- dev-dependabot/npm_and_yarn/nanoid-3.3.8
- dev-feature/2/ite-datacom
- dev-master
This package is auto-updated.
Last update: 2024-12-14 09:55:02 UTC
README
Adds support to Silverstripe for authentication and identity assertion via RealMe.
This module provides the foundation to support a quick integration for a Silverstripe application with RealMe as an identity provider. This module requires extensive setup prior to being utilised effectively.
If integration with RealMe is wanted, it is best to get in touch with the RealMe team as early as possible. This can be accomplished by getting in touch with the RealMe team.
If you encounter any issues please open a new issue here.
Installation
composer require silverstripe/realme
Configuration of RealMe for your application
RealMe provide two testing environments and a production environment for you to integrate with. Access to these environments is strictly controlled, and more information on these can be found on the RealMe Developers site.
See configuration.md for environment and YML configuration required before the module can be used.
Providing RealMe login buttons
By default, the module provides an Authenticator
class in SilverStripe, adding a new login form. If you want to provide your own separate login form just for RealMe, then the built-in templates can help
with this. They have been designed to integrate as cleanly as possible with Silverstripe templates, but it is up to you
whether you use them, or roll your own.
See the templates documentation for more information on using or modifying these.
Testing for authentication
The RealMeService
service object allows you to inject authentication where-ever it is required. For example, let's
take a simple Controller that ensures that all users have a valid RealMe 'FLT' (a unique string that identifies a RealMe
user, but is not their username):
use SilverStripe\Control\Controller; use SilverStripe\Control\HTTPRequest; use SilverStripe\RealMe\RealMeService; class RealMeTestController extends Controller { /** * @var RealMeService */ public $realMeService; private static $dependencies = array( 'realMeService' => '%$SilverStripe\RealMe\RealMeService' ); public function index(HTTPRequest $request) { // enforceLogin will redirect the user to RealMe if they're not authenticated, or return true if they are // authenticated with RealMe. It should only ever return 'false' if there was an error initialising config if($this->realMeService->enforceLogin($request)) { $userData = $this->realMeService->getUserData(); printf("Congratulations, you're authenticated with a unique ID of '%s'!", $userData->SPNameID); } else { echo "There was an error while attempting to authenticate you."; } } }
Appreciation
- Sincere thanks to Jackson (@jakxnz) for his work reviewing and updating pull requests.