Get support for KnpLabs/knpSsoPlugin
If you're new to LTH, please see our FAQ for more information on what it is we do.
Support Options
Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:
View Open IssuesTake a look to see if anyone else has experienced the same issue as you and if they managed to solve it.
Open an IssueMake sure to read any relevant guidelines for opening issues on this repo before posting a new issue.
Sponsor directlyCheck out the page and see if there are any options to sponsor this project or it's developers directly.
KnpLabs/knpSsoPlugin
#knpSsoPlugin
The knpSsoPlugin is a symfony 1.4 plugin that provides authentication via SSO above the standard security feature of symfony.
It gives you the model (user) and the modules (frontend) to secure your symfony application in a minute in a configurable plugin. It does not require a database as the user infos are only stored in the user session.
Credits go to the knpLabs team.
Installation
-
Install the plugin (via a git submodule)
git submodule add git://github.com/knplabs/knpSsoPlugin.git plugins/knpSsoPlugin -
Activate the plugin in the
config/ProjectConfiguration.class.php[php] class ProjectConfiguration extends sfProjectConfiguration { public function setup() { $this->enablePlugins(array( 'knpSsoPlugin', '...' )); } }
Secure your application
To secure a symfony application:
-
Enable the module
knpSsoAuthinsettings.ymlall: .settings: enabled_modules: [..., knpSsoAuth] -
Change the default login and secure modules in
settings.ymllogin_module: knpSsoAuth login_action: signin secure_module: knpSsoAuth secure_action: secure -
Change the parent class in
myUser.class.phpclass myUser extends knpSsoSecurityUser { } -
Optionally add the following routing rules to
routing.ymlknp_sso_signin: url: /login param: { module: knpSsoAuth, action: signin } knp_sso_signout: url: /logout param: { module: knpSsoAuth, action: signout }You can customize the
urlparameter of each route.These routes are automatically registered by the plugin if the module
knpSsoAuthis enabled unless you definedknp_sso_plugin_routes_registerto false in theapp.ymlconfiguration file:all: knp_sso_plugin_routes_register: routes_register: false -
Secure some modules or your entire application in
security.ymldefault: is_secure: true -
Configure your SSO server in your
app.ymlall: knp_sso_plugin: # sso_plugin_signin_form: knpSsoFormSignin # sso_key_parameter: sso_key # name of the GET parameter you will use # sso_fetcher_class: knpSsoFetcher sso_fetcher_options: method: demo.validateSso url: http://www.knplabs.com/xmlrpc.php -
You're done. Now, if you try to access a secure page with a valid sso_key as a parameter, you will have access to the page.
Customize knpSsoAuth module actions
If you want to customize or add methods to the knpSsoAuth:
-
Create a
knpSsoAuthmodule in your application -
Create an
actions.class.phpfile in youractionsdirectory that inherit fromBaseknpSsoAuthActions(don't forget to include theBaseknpSsoAuthActionsas it can't be autoloaded by symfony)<?php require_once(sfConfig::get('sf_plugins_dir').'/knpSsoPlugin/modules/knpSsoAuth/lib/BaseknpSsoAuthActions.class.php'); class knpSsoAuthActions extends BaseknpSsoAuthActions { public function executeNewAction() { return $this->renderText('This is a new knpSsoAuth action.'); } }
knpSsoSecurityUser class
This class inherits from the sfBasicSecurityUser class from symfony and is used for the user object in your symfony application (because you changed the myUser base class earlier).
So, to access it, you can use the standard $this->getUser() in your actions or $sf_user in your templates.
knoSsoSecurityUser adds some methods:
-
signIn()andsignOut()methods
Validators
knpSsoPlugin comes with a validator that you can use in your modules:
knpSsoValidatorUser.
Our Mission
We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.
From the Blog
Interesting Articles
-
Generating income from open source
Jun 23 • 8 min read
-
2023 State of OSS
Apr 23 • 45 min read ★
-
A funding experiment...
Aug 19 • 10 min read
-
But You Said I could
Aug 19 • 2 min read
Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated
p-e622a1a2