这是kbmmw 作者关于认证管理器的说明,我懒得翻译了,自己看吧。

There are 5 parts of setting up an authorization manager:

A) Defining what the resources are (often services or service functions,
but can be anything you want to protect).

B) Defining who the actors (typically users) are.

C) Defining which roles you want actors to be able to participate as
towards the application server.

D) Defining authorizations for actors or roles on resources.

E) Optionally defining constraint on authorizations and/or logins.

Normally, the only one who really knows which resources exists, is the
developer of the application server as a

resource typically is very
application server type specific (service name, function name, virtual
function/external file name or something like that).

Resources would usually always be defined in the application server, and
never be picked up from a database, unless its resources that refers

to
external files/resources not known by the application server at compile
time.

Similarly with roles. What basic role types are relevant for a
particular application server is normally known at compile time. Hence
they would typically also be defined by the developer, early on.

Actors can be defined at compile time, but thats not the typical use
scenario, except for internal actors that cant be used for login from
outside (see next paragraph for an example). Most often you want to
maintain an external database/configuration file where the actor, which
his password and default role is stored.

Authorizations for a resource is typically defined on a role, but _CAN_
also be linked directly to an actor, although I want to discourage that
scenario, unless you define the actor at compile time, in which case the
actor is typically used for some internal special security stuff, that
are not to be messed with by an human administrator. An example is a
special actor that do not allow login as the actor, but that do allow
for internal execution of one service from another service.

Authorizations most often makes sense to define at compile time. There
could perhaps be imagined scenarios where a role should have more or
less authorizations towards resources depending on time of day or other
constraints, but that is why the constraint definition exists (ie.. only
allow being an administrator from 9:00-17:00, outside this timespan,
disallow administrator login etc). If you want to have multiple levels
of administrators (one with time limits and one super admin role without
time limits) define two roles, and limit login with constraints on one
of them.

So what you want to define in an external database/configuration file,
typically boils down to real human actors with passwords and the default
role they have when logging in. The remaining bits are usually known at
compile time or at least as a one time configuration when the server
starts up.

The login process, that validates given credentials with defined
authorizations, is a crucial part of the authorization manager.

Thus one way or the other, you will want to call the Login method of the
authorization manager. It can happen by explicitly calling the Login
method in a service function which is not protected by the authorization
manager (or else you would probably not be allowed to execute that
function in the first place), or you can let the application server
automatically determine when a login is needed.

The later is the easiest way. For that to happen, you must set the
TkbmmWAuthorizationManager.Options to include the mwaoAutoLogin flag.

With that setting, if a client tries to call a server service, and the
client is not providing a TkbmMWClientIdentitity.Token (its empty), the
authorization manager will attempt a login with the username and
password provided in the TkbmMWClientIdentity, and an empty role name.

If the login succeeds, a new server generated token will be returned to
the client, which should be used in subsequent requests for the duration
of the login.

The Login call itself, first tries to lookup an actor and if a role name
was given (which is not the case when using mwaoAutoLogin) the role.

Since the actor is not known by the authorization manager at this point
in time (a TkbmMWAuthorizationActor has not been predefined), the login
will fail, unless you put some code in the OnLogin event handler.

The eventhandler will be called with the provided username (AActorName)
and password (APassphrase).

You will also get a reference to whatever TkbmMWAuthorizationActor that
the authorization manager have found for your. It will be nil, if the
user with that username has not logged in since last application server
startup.

Now its your responsibility to lookup that username/password for example
in a database, determine what (predefined) role the person should have
and return those values in the AActor and ARole arguments of the event.

Lets say you lookup the username/pwd in the database and fails to find a
person matching, you would simply return AActor:=nil and ARole:=nil, and
optionally set AMessage to some text that explains the reason for the
failure to login.

If you do find the username/pwd in your database, you first lookup which
role the user should have. Eg:

ARole:=authmanager.GetRole(somerolename);

Then, if the provided AActor was nil, you MUST define the actor on the
TkbmMWAuthorizationManager by calling AddActor with the
username/password and the looked up role and return that actor. Eg:

AActor:=authmanager.AddActor(AActorName,APassPhrase,somerolename);

Next step after the login, is the authorization manager authenticates
the actual request the client is making.

That usually happens automatically according to your predefined
authorizations/constraints.

You _can_ also hook into this, by the OnAuthorize event. Usually you
will at most disallow an otherwise given authorization, this way, by
setting AAuthorization:=nil if you do not allow the actor to access that
particular resource, even though your authorization rules has allowed it.

You can logout a user by calling AuthMgr.Logout, or let the logout
garbage collection handle it. I.e. if a user has been inactive for too
long, it can be auto logged out (DefaultMaxIdleTime property on the
authmgr given in secs - default 1 hour).

best regards

Kim Madsen

C4D

KbmMW 认证管理器说明(转载)的更多相关文章

  1. 使用delphi 开发多层应用(二十二)使用kbmMW 的认证管理器

    从kbmmw 4.4 开始,增加了认证管理器,这个比原来的简单认证提供了更多的功能.细化了很多权限操作. 今天对这一块做个介绍. 要做一个认证管理,大概分为以下5步: 1.  定义你要保护的资源,一般 ...

  2. cas 认证管理器

    CAS-默认的认证管理器:AuthenticationManagerImpl <bean id="authenticationManager" class="org ...

  3. JMeter学习(二十四)HTTP属性管理器HTTP Cookie Manager、HTTP Request Defaults(转载)

    转载自 http://www.cnblogs.com/yangxia-test Test Plan的配置元件中有一些和HTTP属性相关的元件:HTTP Cache Manager.HTTP Autho ...

  4. 宣布 Windows Azure 通过 PCI DSS 合规性验证并且 ISO 认证范围扩大,同时正式发布 Windows Azure Hyper-V 恢复管理器和其他更新功能

    今天,我们高兴地宣布两个重大里程碑事件,客户将能借此提高基于 Windows Azure 构建安全且合规的应用程序的能力.此外,我们还宣布正式发布 Windows Azure Hyper-V 恢复管理 ...

  5. com.ibm.msg.client.jms.DetailedJMSSecurityException: JMSWMQ2013: 为队列管理器提供的安全性认证无效

    com.ibm.msg.client.jms.DetailedJMSSecurityException: JMSWMQ2013: 为队列管理器“zm_queue_manager”提供的安全性认证无效, ...

  6. KBMMW 的日志管理器

    kbmmw 4.82 最大的新特性就是增加了 日志管理器. 新的日志管理器实现了不同类型的日志.断言.异常处理.计时等功能. 首先.引用kbmMWLog.pas 单元后,系统就默认生成一个IkbmMW ...

  7. ASP.NET MVC 认证模块报错:“System.Configuration.Provider.ProviderException: 未启用角色管理器功能“

    新建MVC4项目的时候 选 Internet 应用程序的话,出来的示例项目就自带了默认的登录认证等功能.如果选空或者基本,就没有. 如果没有,现在又想加进去,怎么办呢? 抄啊.将示例项目的代码原原本本 ...

  8. vim插件管理器:Vundle的介绍及安装(很全)(转载)

    转载自:https://blog.csdn.net/zhangpower1993/article/details/52184581 背景 Vim缺乏默认的插件管理器,所有插件的文件都散布在~/.vim ...

  9. 如何正确理解关键字"with"与上下文管理器(转载)

    如果你有阅读源码的习惯,可能会看到一些优秀的代码经常出现带有 “with” 关键字的语句,它通常用在什么场景呢?今天就来说说 with 和 上下文管理器. 对于系统资源如文件.数据库连接.socket ...

随机推荐

  1. angular 中怎么获取路径上的参数 参考:https://docs.angularjs.org/api/ng/service/$location

    参考: https://docs.angularjs.org/api/ng/service/$location

  2. 机器学习入门-概率阈值的逻辑回归对准确度和召回率的影响 lr.predict_proba(获得预测样本的概率值)

    1.lr.predict_proba(under_text_x)  获得的是正负的概率值 在sklearn逻辑回归的计算过程中,使用的是大于0.5的是正值,小于0.5的是负值,我们使用使用不同的概率结 ...

  3. Mysql 表名大写 找不到表

    原来Linux下的MySQL默认是区分表名大小写的,通过如下设置,可以让MySQL不区分表名大小写:1.用root登录,修改 /etc/my.cnf:2.在[mysqld]节点下,加入一行: lowe ...

  4. SpringMvc Intercetor

    对于登录的访问控制以及session的超时控制. 当用户在未登录情况下,直接在地址栏输入url进入某些页面时,会越过登录页,如果不做控制会有安全问题. 因此可添加拦截器处理异常: /** * @Des ...

  5. chrome 设置是否缓存

    在进行本地开发时,因老需要修改js,css等文件,而页面又带有缓存因此无法自动更新为新的文件. 在页面点击 -> F12 ->F1 ->References -> NetWor ...

  6. 【转载】 Java并发编程:深入剖析ThreadLocal

    原文链接:http://www.cnblogs.com/dolphin0520/p/3920407.html感谢作者的辛苦总结! Java并发编程:深入剖析ThreadLocal 想必很多朋友对Thr ...

  7. MeToo, one year on

    表示转折/让步关系:but, however, nevertheless, whereas, although, despite, in spite of, still 表示比较或对比关系:simil ...

  8. Hadoop主要架构

    主要架构图 各部分作用 * Core:核心支持,内核代码 * MapReduce:映射数据 * HDFS:文件存储 * ZooKepper:服务器节点和进程通信的协调工具 * Pig:支持用户和Map ...

  9. scala--函数式对象

    函数式对象 这次写点关于函数式对象的吧 class Rational(n:Int, d:Int) { // n,d 为类参数,scala会创造出同样带有这两个参数的主构造器.如果这个类没有主体,可以不 ...

  10. 基元线程同步构造之 Mutes(互斥体)

    互斥体实现了“互相排斥”(mutual exclusion)同步的简单形式(所以名为互斥体(mutex)). 互斥体禁止多个线程同时进入受保护的代码“临界区”(critical section). 因 ...