前回 の続き。WS-Securityはちょっと大げさだし重いという噂なので、もっと単純にHTTPのBASIC認証を試してみる。 前回はWebサービス自身が認証を行う形式だったけど、今回はWebサービスの前に Spring Security のフィルタをかませて、認証は Spring Security に任せる方式にする(その方が慣れているし色々取り替えが利くので)。さらに、クライアント側のWebアプリケーションが送りつけるBASIC認証のユーザ名・パスワードは、Webアプリケーションへログインしたときのユーザ名・パスワードをそのまま使うようにする。 サービス実装側の修正 前回追加したWS-Securityの部分は取り外して、Spring Securityを使えるように設定する。 まず、pom.xml。dependencies要素の中に、Spring Securityに必要な以下の設定を追加