10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SwiftとPlayframework(Java)でログイン処理を書いてみた。(アプリ側とサーバー側の連携)

Last updated at Posted at 2014-10-19

初投稿です。
ログインシステムとして甘すぎるなど
突っ込みどころ満載だと思いますが、
アプリ側とサーバー側の連携の簡単なサンプルとして以下のようなものを作ってみました。

①アプリ側(swift)でユーザー名とパスワードをサーバー(Playframework Java)に送信。
②サーバー側でDBにあるユーザーデータと照合。
③結果をアプリ側に返してログイン成功、失敗ごとに処理を分岐。

プログラム初心者なのでいろいろとご指摘いただけると幸いです。

環境

アプリ側:Xcode 6.0.1
サーバー側:Playframework2.3.5(java)
データベース:Mysql

Screen Shot

スクリーンショット 2014-10-19 午後2.37.44.png

ソースコード(Github)

アプリ側(swift):https://github.com/yuinchirn/loginSample
サーバー側(playframework java):https://github.com/yuinchirn/loginSample-server

DB構造(Mysql)

データベース名:loginSample
テーブル名:user_account

CREATE文

CREATE TABLE `user_account` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `user_name` varchar(255) DEFAULT NULL,
  `user_hash` varchar(255) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  `create_date` datetime DEFAULT NULL,
  `update_date` datetime DEFAULT NULL,
  `delete_flg` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

user_nameとpasswordのカラムに入れた文字列が
ログイン認証に使われます。

10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?