JBoss DataBaseServerLoginModule中的Role vs RoleGroup [英] Role vs RoleGroup in JBoss DataBaseServerLoginModule

查看:145
本文介绍了JBoss DataBaseServerLoginModule中的Role vs RoleGroup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

A部分:角色与角色组

有人可以解释jboss DatabaseServerLoginModule 中的 Role RoleGroup 之间的区别吗?看完中的示例后,我感到困惑JBoss 6文档

Can someone explain the difference between a Role and a RoleGroup in the jboss DatabaseServerLoginModule? I'm confused after looking at the examples in the JBoss 6 documentation

混乱的一个方面是,当它们描述用户到角色映射表的逻辑表时,它具有三列:

One area of confusion is when they describe the logical tables the user to role mapping table has three columns:

Table Principals(PrincipalID text, Password text)
Table Roles(PrincipalID text, Role text, RoleGroup text)

但是他们提供的示例仅使用两列:

But the example they offer only uses two columns:

CREATE TABLE Users(username VARCHAR(64) PRIMARY KEY, passwd VARCHAR(64))
CREATE TABLE UserRoles(username VARCHAR(64), userRoles VARCHAR(32))

两列是错别字还是我可以使用两列用户到我更熟悉的角色映射表,以及从单个源列userRoles创建两列的查询,现在Roles和RoleGroup现在将相同为此应用

Is the two columns a typo or can I use the two column user to role mapping table that I am more familiar with and the query creating two columns from a single source column userRoles and now the Roles and RoleGroup will now be the same for this app.

BTW-在 Glassfish的传统jdbcRealm身份验证中3 和更早的 jBoss3 它简单的一对多关系,并且有一个user_group表,其中用户名映射到组名.

BTW - In traditional jdbcRealm authentication in Glassfish 3 and the earlier jBoss3 it a simple one to many relationship and there is a user_group table where usernames are mapped to the group names.

B部分:rolesQuery

此查询是否需要从以下版本进行修订:

Does this query need to be revised from:

select userRoles, 'Roles' from UserRoles where username=?

对此:

select userRoles, userRoles as 'Roles' from UserRoles where username=?

要想在UserRoles表上起作用,还是可以吗?

In order to function on the UserRoles table or is it okay as it is?

C部分:映射web.xml

我将在web.xml中限制userRoles或Roles列的资源吗?

In the web.xml will I be constraining resources the userRoles or the Roles column?

推荐答案

我能够获得

I was able to get my login working so now I can provide a decent answer to Part B:

当然不需要修改查询. JBoss 6特别希望在两列结果集中构造一个表,其中用户名(或主体)匹配?"并且第一列将是用户所在的组,第二列只是条目"Roles".

Certainly do not need to revise the query. JBoss 6 specifically expects at two column result set where a table will be constructed where username (or principal) matches '?' and the first column will be the group that user is in and the second column is just the entry "Roles".

这是JBoss特有的,支持表的示例为:

It is JBoss specific and an example of backing table would be:

username | groupid
--------------
james | admin
james | users
james | backupadmin
admin | admin

,当用户名 james 尝试登录 rolesQuery 时的结果集将是:

and a result set when the username james attempts to login for the rolesQuery would be:

col1 | col2
--------------
admin | Roles
users | Roles
backupadmin | Roles

这篇关于JBoss DataBaseServerLoginModule中的Role vs RoleGroup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆