チーム開発
チーム開発のプロジェクト管理にBacklogを使用する。
Backlogには、課題管理、Git、Wikiなどの便利なツールがある。
チーム開発を通して、各ツールの使い方に慣れる。
今後の作業の進め方
- スタートアップミーティング
- チームでの開発作業
- ふりかえり
スタートアップミーティング
朝、10分程度のスタートアップミーティングを行う。
ミーティングで以下の内容を決める。
- 1日のチーム内の作業分担を決める。
- 各人がBacklogに課題を登録する。
チーム開発作業
ひとりで難しいときはペアプログラミングで効率を上げる。
課題に書いた内容を実装する。
- ドキュメント整理(Wikiを活用)
- JSP作成
- コントローラ作成
- エンティティ作成
Wikiで整理するとよさそうな情報
- ロバストネス図(画面遷移図)
- 画面デザイン
- クラス図
- シーケンス図
12:50ごろから1日のふりかえりを行う
ミーティング後、全員の課題を確認する。
KPT : Keep / Problem / Try
- 全員の課題の進捗確認。
- チームごとのKPTの確認。
Spring Securityによるユーザー認証
サイトにログイン機能を追加するには、Spring Security を使用すると簡単に実装できる。
Spring Security の設定ファイルを読み込ませるために、contextConfigLocation を追加する。
pom.xmlの変更
Spring Security のライブラリを追加する。
pom.xml
<dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> <version>4.0.1.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-web</artifactId> <version>4.0.1.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-config</artifactId> <version>4.0.1.RELEASE</version> </dependency>
pom.xml を変更したら、プロジェクトの更新と、maven install を実行する。
設定ファイルを読み込ませる
web.xml
<context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/application-config.xml</param-value> </context-param> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/spring-security.xml</param-value> </context-param>
設定ファイルを作成する
src/main/resources/spring フォルダに、spring-security.xml を作成する。
まずはXMLで指定したユーザーでログインできるようにする。
ユーザー名: user
パスワード: user
あとでDBから取得するように変更する。
spring-security.xml
<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.0.xsd"> <http pattern="/" security="none"/> <http pattern="/index.jsp" security="none"/> <http auto-config="true" > <intercept-url pattern="/**" access="hasRole('ROLE_USER')" /> <form-login /> <logout /> </http> <authentication-manager> <authentication-provider> <user-service> <user name="admin" password="admin" authorities="ROLE_ADMIN" /> <user name="user" password="user" authorities="ROLE_USER" /> </user-service> </authentication-provider> </authentication-manager> </beans:beans>
すべてのページにアクセスする前にアクセス権限のチェックを実行させるため、web.xml の最後に、フィルターを追加する。
web.xml
<filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>