Relativity DBCommandLoginProvider (.NET and Delphi)

From RemObjects Wiki

Jump to:navigation, search

This is a Data Abstract Relativity Server topic
Feel free to add your notes to this topic below.


Contents

Overview

Relativity server provides several different LoginProviders. DBCommandLoginProvider uses SchemaCommand to check user credentials. This means that it is possible to perform login logging, advanced password checks, store hashed passwords in database etc. Obviously this LoginProvider cannot be used in AdminService as it needs some SchemaCommand and connection to access underlying database.

At the same time DBCommandLoginProvider has one disadvantage - it is not able to automatically load authenticated users settings into his session like other LoginProviders.


This document describes how to configure DBCommandLoginProvider.


Login Provider configuration

Overview

To be able to use DBCommandLoginProvider you need to do the following steps:

Stored Procedure

DBCommandLoginProvider uses stored procedure that accepts users name and password and return 1 or 0 as authentication result where 1 means success.

DBCommandLoginProvider supports 2 ways to return authentication result from StoredProcedure - via result or output parameter.

Here are sample procudure that uses Result parameter:

CREATE PROCEDURE [dbo].[LoginProvider]
	@pUserName	NVARCHAR(50),
	@pPassword	NVARCHAR(50)
AS
BEGIN
SET NOCOUNT ON;

IF  (EXISTS(SELECT * FROM dbo.Employees WHERE LastName = @pUserName AND FirstName = @pPassword))
	RETURN 1
ELSE
	RETURN 0;
END

Sample procudure that uses Output parameter:

CREATE PROCEDURE [dbo].[LoginProvider]
	@pResult    INT OUTPUT,
	@pUserName	NVARCHAR(50),
	@pPassword	NVARCHAR(50)
AS
BEGIN
SET NOCOUNT ON;

IF  (EXISTS(SELECT * FROM dbo.Employees WHERE LastName = @pUserName AND FirstName = @pPassword))
	SET @pResult = 1
ELSE
	SET @pResult = 0;
END

Note: StoredProcedure should use exactly this parameters order (ie [user name][password] or [result][user name][password]). Also please note that LoginProvider expects result of integer or long integer type.


SchemaCommand definition

Defined SchemaCommand should have 3 parameters:

SchemaCommand Configuration

Domain configuration

To use DBCommandLoginProvider in Relativity Domain it should be configured first:

Login Provider should be set to DbCommandLoginProvider and its SchemaCommand name parameter should be set to SchemaCommand defined at previous step.

LoginProvider Configuration
Ro-48.png

Product: RemObjects SDK
Available Editions: RemObjects SDK for .NET, Delphi, Xcode, Java and JavaScript

GlossaryArchitectureArticlesFeaturesLibrarySamples

Navigation
products
platforms
special
Toolbox