📄 jdbcrealm.properties
字号:
# # This is a sample properties file for the org.mortbay.jetty.security.JDBCUserRealm# implemtation of the UserRealm interface. This allows Jetty users authentication # to work from a database.## +-------+ +------------+ +-------+# | users | | user_roles | | roles |# +-------+ +------------+ +-------+# | id | /| user_id |\ | id |# | user -------| role_id |------- role |# | pwd | \| |/ | |# +-------+ +------------+ +-------+# # # 'cachetime' is a time in seconds to cache positive database# lookups in internal hash table. Set to 0 to disable caching.# ## For MySQL:# create a MYSQL user called "jetty" with password "jetty"## Create the tables:# create table users # (# id integer primary key,# username varchar(100) not null unique key,# pwd varchar(20) not null# );# # create table roles# (# id integer primary key,# role varchar(100) not null unique key# ); ## create table user_roles# (# user_id integer not null,# role_id integer not null,# unique key (user_id, role_id),# index(user_id)# );## I'm not sure unique key with a first component of user_id will be# user by MySQL in query, so additional index wouldn't hurt.## To test JDBC implementation:## mysql> insert into users values (1, 'admin', 'password');# mysql> insert into roles values (1, 'server-administrator');# mysql> insert into roles values (2, 'content-administrator');# mysql> insert into user_roles values (1, 1);# mysql> insert into user_roles values (1, 2);## Replace HashUserRealm in etc/admin.xml with JDBCUserRealm and# set path to properties file.#jdbcdriver = org.gjt.mm.mysql.Driverurl = jdbc:mysql://localhost/jettyusername = jettypassword = jettyusertable = usersusertablekey = idusertableuserfield = usernameusertablepasswordfield = pwdroletable = rolesroletablekey = idroletablerolefield = roleuserroletable = user_rolesuserroletableuserkey = user_iduserroletablerolekey = role_idcachetime = 300
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -