2016-09-18 19:19:23 +02:00
|
|
|
// ***************************************************************************
|
|
|
|
//
|
|
|
|
// Delphi MVC Framework
|
|
|
|
//
|
|
|
|
// Copyright (c) 2010-2016 Daniele Teti and the DMVCFramework Team
|
|
|
|
//
|
|
|
|
// https://github.com/danieleteti/delphimvcframework
|
|
|
|
//
|
|
|
|
// ***************************************************************************
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
// *************************************************************************** }
|
|
|
|
|
2013-10-30 01:09:09 +01:00
|
|
|
unit WebModuleUnit;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses System.SysUtils,
|
|
|
|
System.Classes,
|
|
|
|
Web.HTTPApp,
|
|
|
|
MVCFramework;
|
|
|
|
|
|
|
|
type
|
2016-09-20 11:27:33 +02:00
|
|
|
Tbas = class(TWebModule)
|
2013-10-30 01:09:09 +01:00
|
|
|
procedure WebModuleCreate(Sender: TObject);
|
|
|
|
private
|
|
|
|
MVCEngine: TMVCEngine;
|
|
|
|
end;
|
|
|
|
|
|
|
|
var
|
2016-09-20 11:27:33 +02:00
|
|
|
WebModuleClass: TComponentClass = Tbas;
|
2013-10-30 01:09:09 +01:00
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
2016-09-16 23:54:54 +02:00
|
|
|
|
2013-11-08 23:10:25 +01:00
|
|
|
uses
|
2015-04-01 17:01:23 +02:00
|
|
|
TestServerControllerU, TestServerControllerExceptionU, SpeedMiddlewareU,
|
|
|
|
MVCFramework.Middleware.Authentication, System.Generics.Collections,
|
2016-09-18 12:02:24 +02:00
|
|
|
MVCFramework.Commons, TestServerControllerPrivateU, AuthHandlersU;
|
2013-10-30 01:09:09 +01:00
|
|
|
|
2016-09-20 11:27:33 +02:00
|
|
|
procedure Tbas.WebModuleCreate(Sender: TObject);
|
2013-10-30 01:09:09 +01:00
|
|
|
begin
|
2015-04-01 17:01:23 +02:00
|
|
|
MVCEngine := TMVCEngine.Create(self,
|
|
|
|
procedure(Config: TMVCConfig)
|
|
|
|
begin
|
|
|
|
Config[TMVCConfigKey.Messaging] := 'true';
|
2016-09-06 10:30:52 +02:00
|
|
|
end, nil);
|
2016-02-23 23:22:44 +01:00
|
|
|
MVCEngine.AddController(TTestServerController)
|
|
|
|
.AddController(TTestPrivateServerController)
|
2013-12-05 16:19:01 +01:00
|
|
|
.AddController(TTestServerControllerExceptionAfterCreate)
|
2014-03-31 11:25:16 +02:00
|
|
|
.AddController(TTestServerControllerExceptionBeforeDestroy)
|
2016-09-16 23:54:54 +02:00
|
|
|
.AddController(TTestPrivateServerControllerCustomAuth)
|
2015-04-01 17:01:23 +02:00
|
|
|
.AddMiddleware(TMVCSpeedMiddleware.Create)
|
2016-09-16 23:54:54 +02:00
|
|
|
.AddMiddleware(TMVCBasicAuthenticationMiddleware.Create(TBasicAuthHandler.Create))
|
2016-09-18 19:19:23 +02:00
|
|
|
.AddMiddleware(TMVCCustomAuthenticationMiddleware.Create(TCustomAuthHandler.Create, '/system/users/logged'));
|
2015-04-01 17:01:23 +02:00
|
|
|
|
|
|
|
// MVCEngine.Config[TMVCConfigKey.Messaging] := 'false';
|
|
|
|
end;
|
|
|
|
|
|
|
|
{ TSampleAuth }
|
2016-09-16 23:54:54 +02:00
|
|
|
{ TBasicAuthHandler }
|
|
|
|
{ TCustomAuthHandler }
|
|
|
|
|
2013-10-30 01:09:09 +01:00
|
|
|
end.
|