Auth with SSO (#387)

* add logout v2 for sso

* support sms-code login

* use db instead of memory cache for login code

* feature: support reset password by sms code

* remove deprecated api/code

* feature: support image captcha

* use db instead of memory cache for sso.auth.state

* add authLogin for login, v1/login; support (*)[.local].tpl for tpl file

* add username to sms-code api

* disable captcha by default in rdb.yml
This commit is contained in:
yubo 2020-11-10 13:23:37 +08:00 committed by GitHub
parent 2d1a2fd187
commit b2baef0643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 10 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
# release version
version=3.2.0
version=3.3.0
CWD=$(cd $(dirname $0)/; pwd)
cd $CWD

View File

@ -24,7 +24,7 @@ sso:
coverAttributes: false
stateExpiresIn: 300
captcha: true
captcha: false
tokens:
- rdb-builtin-token

View File

@ -297,18 +297,17 @@ CREATE TABLE `login_code`
DEFAULT CHARSET = utf8;
CREATE TABLE `auth_state` (
`state` varchar(128) DEFAULT '' NOT NULL,
`typ` varchar(32) DEFAULT '' NOT NULL COMMENT 'response_type',
`redirect` varchar(1024) DEFAULT '' NOT NULL,
`expires_at` bigint DEFAULT '0' NOT NULL,
`state` varchar(128) DEFAULT '' NOT NULL,
`typ` varchar(32) DEFAULT '' NOT NULL COMMENT 'response_type',
`redirect` varchar(1024) DEFAULT '' NOT NULL,
`expires_at` bigint DEFAULT '0' NOT NULL,
PRIMARY KEY (`state`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `captcha` (
`captcha_id` varchar(128) NOT NULL,
`answer` varchar(128) DEFAULT '' NOT NULL,
`created_at` bigint DEFAULT '0' NOT NULL,
`captcha_id` varchar(128) NOT NULL,
`answer` varchar(128) DEFAULT '' NOT NULL,
`created_at` bigint DEFAULT '0' NOT NULL,
KEY (`captcha_id`, `answer`),
KEY (`created_at`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8;

30
sql/n9e_rdb_3.3.0.sql Normal file
View File

@ -0,0 +1,30 @@
set names utf8;
use n9e_rdb;
CREATE TABLE `login_code`
(
`username` varchar(64) not null comment 'login name, cannot rename',
`code` varchar(32) not null,
`login_type` varchar(32) not null,
`created_at` bigint not null comment 'created at',
KEY (`code`),
KEY (`created_at`),
UNIQUE KEY (`username`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE `auth_state` (
`state` varchar(128) DEFAULT '' NOT NULL,
`typ` varchar(32) DEFAULT '' NOT NULL COMMENT 'response_type',
`redirect` varchar(1024) DEFAULT '' NOT NULL,
`expires_at` bigint DEFAULT '0' NOT NULL,
PRIMARY KEY (`state`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `captcha` (
`captcha_id` varchar(128) NOT NULL,
`answer` varchar(128) DEFAULT '' NOT NULL,
`created_at` bigint DEFAULT '0' NOT NULL,
KEY (`captcha_id`, `answer`),
KEY (`created_at`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8;