jp.mosp.common.bean
クラス AuthBean

java.lang.Object
  上位を拡張 jp.mosp.common.bean.AuthBean

public class AuthBean
extends Object

認証処理ユーティリティ

導入されたバージョン:
3.0.2
バージョン:
0.0.1
作成者:
m.yoshida

フィールドの概要
static String KEY_EXCEPTION_CODE
           
static String KEY_MESSAGE_CODE
           
static String KEY_USER
           
 
コンストラクタの概要
AuthBean()
          コンストラクタ
AuthBean(Properties cfg, String cmd, CmAspUserDto aspUser, Connection conn, boolean hasMospSeJar)
          コンストラクタ
AuthBean(String userId, String password, Properties cfg, String cmd, CmAspUserDto aspUser, Connection conn, boolean hasMospSeJar)
          コンストラクタ(認証処理実行) 結果の取得方法等は、login(String, String)を参照すること。
 
メソッドの概要
 CmUserDto getCmUserDto()
          CmUserDto取得
 String getErrMessageCode()
          認証失敗メッセージ取得
 int getMosPExceptionCode()
          MosPExceptionコード取得
 void init(Properties cfg, String cmd, CmAspUserDto aspUser, Connection conn, boolean hasMospSeJar)
          ユーティリティの初期化
 boolean isErrMessage()
          認証失敗メッセージ有無
 void login(String userId, String password)
          認証処理
 void setAuthFailedMessage(String msgCode, int exCode)
          認証失敗メッセージ設定
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

KEY_MESSAGE_CODE

public static final String KEY_MESSAGE_CODE
関連項目:
定数フィールド値

KEY_EXCEPTION_CODE

public static final String KEY_EXCEPTION_CODE
関連項目:
定数フィールド値

KEY_USER

public static final String KEY_USER
関連項目:
定数フィールド値
コンストラクタの詳細

AuthBean

public AuthBean()
コンストラクタ


AuthBean

public AuthBean(Properties cfg,
                String cmd,
                CmAspUserDto aspUser,
                Connection conn,
                boolean hasMospSeJar)
コンストラクタ

パラメータ:
cfg - MosPアプリケーション設定(/WEB-INF/mosp.properties)。
cmd - リクエストされたCommand。
aspUser - ログインASPユーザー。
conn - DBコネクション。
hasMospSeJar - mosp-se.jar有無
getConnection(String, String, String, String) により、設定される。

AuthBean

public AuthBean(String userId,
                String password,
                Properties cfg,
                String cmd,
                CmAspUserDto aspUser,
                Connection conn,
                boolean hasMospSeJar)
         throws Exception
コンストラクタ(認証処理実行)

結果の取得方法等は、login(String, String)を参照すること。

パラメータ:
userId - 対象ユーザID
password - 対象入力パスワード
cfg - MosPアプリケーション設定(/WEB-INF/mosp.properties)。
cmd - リクエストされたCommand。
aspUser - ログインASPユーザー。
conn - DBコネクション。
getConnection(String, String, String, String) により、設定される。
例外:
Exception
メソッドの詳細

init

public void init(Properties cfg,
                 String cmd,
                 CmAspUserDto aspUser,
                 Connection conn,
                 boolean hasMospSeJar)
ユーティリティの初期化

パラメータ:
cfg - MosPアプリケーション設定(/WEB-INF/mosp.properties)。
cmd - リクエストされたCommand。
aspUser - ログインASPユーザー。
conn - DBコネクション。
getConnection(String, String, String, String) により、設定される。

login

public void login(String userId,
                  String password)
           throws Exception
認証処理

パラメータ:
userId - 対象ユーザID
password - 対象入力パスワード
例外:
Exception -

ユーザを取得するにはgetCmUserDto()で取得する。
認証結果を取得するにはisErrMessage()を取得し、成否を判断する。
認証を失敗したら、必ずメッセージコードgetErrMessageCode()と 例外コードgetMosPExceptionCode()を取得する。
メッセージコードからエラーメッセージを生成し、VOのエラーメッセージフィールドにセットする。 例外コードをMospException.MospException(int)にセットし、throwする。


setAuthFailedMessage

public void setAuthFailedMessage(String msgCode,
                                 int exCode)
認証失敗メッセージ設定

パラメータ:
msgCode - 表示メッセージコード
exCode - 対象例外コード
例外:
MospException

isErrMessage

public boolean isErrMessage()
認証失敗メッセージ有無

戻り値:

認証失敗メッセージがある場合true、そうでない場合false
もし認証を失敗したら、必ずMospException.MospException(int)を呼び出すこと。
throwする前に、認証失敗用にDBConnBean.commit()を呼び出すこと。


getCmUserDto

public CmUserDto getCmUserDto()
CmUserDto取得

戻り値:
CmUserDto

getErrMessageCode

public String getErrMessageCode()
認証失敗メッセージ取得

戻り値:
認証失敗メッセージ

getMosPExceptionCode

public int getMosPExceptionCode()
MosPExceptionコード取得

戻り値:
MosPExceptionコード