📄 passwdauthenticator.java
字号:
/* * Copyright (c) 2000 Lyrisoft Solutions, Inc. * Used by permission */package com.lyrisoft.chat.server.remote.auth;import java.io.IOException;import com.lyrisoft.chat.server.remote.AccessDenied;import com.lyrisoft.chat.server.remote.IAuthenticator;import com.lyrisoft.chat.server.remote.Auth;import com.lyrisoft.chat.server.remote.ChatServer;/** * Authenitcator that reads from a password file.<p> * * The file is made up of colon-delimited fields: * <userId>:<access_level>:<password> * <p> * If a user if found in the password file, his password is checked. * If a user is not found in the password file, the access level IAuthenticator.USER * is returned. */public class PasswdAuthenticator implements IAuthenticator { public Auth authenticate(String userId, String password) throws AccessDenied { try { PasswdRecord record = Passwd.getRecord(userId, password); if (record == null) { return new Auth(userId, USER); } else { return new Auth(userId, record.access); } } catch (IOException e) { ChatServer.log(e);// throw new AccessException(Resources.getString("err.passwd.io")); throw new AccessDenied(userId); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -