RAD Server External Credentials Support

From RAD Studio
Jump to: navigation, search

Go Up to RAD Server Engine (EMS Server)


RAD Server allows you to use external credentials in your custom plugins to execute login and signup operations in the RAD Server Engine (EMS Server).

Custom Login Resource

You need to create an empty custom RAD Server package that exposes the custom LoginUser and SignupUser endpoints.

These custom methods should match the signatures of Users.LoginUser and Users.SignupUser endpoints, as follows:

  {$METHODINFO ON}
  [ResourceName('CustomLogin')]
  TCustomLogonResource = class
  public
    [EndpointName('CustomSignupUser')]
    // Declare endpoint that matches signature of Users.SignupUser
    [ResourceSuffix('signup')]
    procedure PostSignup(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse);

    [EndpointName('CustomLoginUser')]
    // Declare endpoint that matches signature of Users.LoginUser
    [ResourceSuffix('login')]
    procedure PostLogin(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse);
  end;
  {$METHODINFO OFF}

The implementation of these methods depends on the validation credentials you are using.

Using the Custom Login Resource

Once the RAD Server Engine loads the custom login resource, you can choose two different ways to use a custom resource for login and signup in the RAD Server Engine (EMS Server):

  • Include custom settings to redirect the Users.LoginUser and Users.SignupUser methods to a custom resource in the emsserver.ini.
[Server.Redirect]
Users.SignupUser={"destination":"CustomLogin"}
Users.LoginUser={"destination":"CustomLogin"}
TEMSProvider.LoginResource:=CustomLogin

See Also