MindTouch Developer Center > MindTouch Deki > FAQ > User Management > How do I...Write a custom authentication provider in .Net

How do I...Write a custom authentication provider in .Net

Creating an authentication provider will allow you to login into Deki Wiki with accounts stored in some other application or database. If you already have users setup in another system then this is a great way to allow them to login with the same credentials into the wiki. This is a pretty straightforward process that will get you setup with how to write an authentication provider and leave the implementation details up to you and your scenario. If you want to integrate with an existing web application, there's a decent chance that a provider has already been written. Be sure to search the forums and this wiki before you begin.

Note that you can use any other language for develoment of this provider by following this spec.

Setup your development environment

Although you don't have to run Visual Studio, Deki Wiki api service is actively developed in VS and it may be the simplest way to get started. There a guide for this here.

Be sure that you're able to use the wiki completely with the UI communicating with the api thats hosted on VS.

Going to http://hostname.for.your.ui/@api/deki/pages/home should work as well

Create and configure your assembly

 

1.  Open VS.NET and select File->New->Project. From the New Project Dialog Box, choose the Windows Class Library template project and name it MyTestAuthService.

2.  To access the Deki Wiki extension framework, select Project->Reference and add a reference to the assemblies below.  These binaries can be found within the bin directory of your Deki Wiki web root (Deki Wiki VM:  /var/www/deki-hayes/bin).

  • log4net.dll
  • mindtouch.deki.ext.dll
  • mindtouch.dream.dll
  • SgmlReaderDll.dll

3. Create a class by copy the contents of one the existing authentication provider examples such as VBulletin, Drupal, Wordpress, etc. Make sure the class inherits from DekiAuthenticationService and at least implements CheckUserPassword, GetUser and optionally GetGroup and GetGroups.

4. Be sure to change the SID attribute and the service description.

Testing and deployment

Now that you have your provider developed, you'll want to test it by copying the assembly over to your bin/services directory. (Create a services directory if it doesn't exist). All assemblies within this folder are automatically loaded when dekihost starts up. You may want to change your project's output path or add a post build event to copy your assembly over.

Restart dekihost and make sure there are no errors at startup.

Add the authentication provider by logging into your wiki as an admin and going to control panel -> service management. Add a local service with type authentication. Enter your SID string and optionally any config settings that will get passed to your service. Type a description that users will see from the login page. Make sure it's enabled and optionally set it as the default. Save the service.

Logout and try to log in as the service. The credentials entered will be passed on to your authentication provider. Validated users will automatically get created if they don't already exist and will continue to be authenticated against the service.

Troubleshooting and common issues
  • Set breakpoints in your service while running in Visual Studio.
  • Get help at the technical forum @ http://forums.opengarden.org and stop by the irc channel: irc.freenode.net #opengarden

 

Tag page
You must login to post a comment.
Powered by MindTouch Deki Enterprise Edition v.8.08 RC2