
Safe modules in XMLNuke Creating your own Login module
How to create your own login module to create personalized access validations.
Table of contents 1. How does validation for secure modules work? 2. Creating Users and Associating Roles 3. How to configure a module? 4. Creating your own Login module 5. How to create your own validation mechanism
On this page Creating a Login module Example
Creating a Login module
Any module valid for XMLNuke may be a Login module as long as the following conditions are met:
- The module must not require authentication
- At the end it should call Context.MakeLogin()
- The name of this module should be configured under the option: xmlnuke.LOGINMODULE so that XMLNuke understands that it will perform the login.
Example
XMLNuke implements a class called LoginBase. This class has several routines for sending emails for events such as forgetting a password, generating a new password, among others. To create your Login module, your class should inherit from the LoginBase and should perform the login mechanism (ask for a username, password, etc.). After the ENTIRE validation process is complete, the lines below should be run in the final step to inform XMLNuke that the user LOGGED IN to the system.
CSharp
// usernamevalid => USERNAME
// userid => User Code
this._context.MakeLogin(usernamevalid, userid);
string Url = FormsAuthentication.GetRedirectUrl(usernamevalid, false);
this._context.redirectUrl( Url );
PHP
// $usernamevalid => USERNAME
// $id => User Code
$urlReturn = $this->_context->ContextValue("ReturnUrl");
$this->_context->MakeLogin($usernamevalid, $id);
$url = XmlnukeManageUrl::decodeParam($urlReturn);
$this->_context->redirectUrl($url);
|