0

我需要为应用程序制作 sso 并组合用户表。

我想使用带有电子邮件身份验证的spring security,没有用户名或密码。

我怎样才能做到这一点?

我的局限:

  • 单个用户可以使用多个电子邮件进行身份验证(如 github)
  • 用户可以管理所有身份验证状态并过期特定身份验证。(在个人资料页面)
  • 没有password。没有字符串usernameid. (因为没有服务支持基本登录)
    ---编辑---
  • OAuth 2.0 / 1.0a 身份验证

生成的方案:(这适用于这种情况吗?)


create table hib_authentication (
        id BIGINT UNSIGNED not null auto_increment,
        firstAuthenticatedTime TIMESTAMP DEFAULT CURRENT_TIMESTAMP not null,
        ip VARBINARY(16) not null,
        browser VARBINARY(24) not null,
        lastAuthenticatedTime TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP not null,
        user_id INT UNSIGNED not null,
        primary key (id)
    ) ENGINE=InnoDB;
    create table hib_user (
        id INT UNSIGNED not null auto_increment,
        country SMALLINT UNSIGNED not null,
        created TIMESTAMP DEFAULT CURRENT_TIMESTAMP not null,
        locale varchar(255) not null,
        timeZone varchar(255) not null,
        primary key (id)
    ) ENGINE=InnoDB;
    create table hib_user_email (
        id BIGINT UNSIGNED not null auto_increment,
        email varchar(255) not null,
        user_id INT UNSIGNED not null,
        primary key (id)
    ) ENGINE=InnoDB;
    create index index_to_get_authentication_by_user on hib_authentication (user_id);
    alter table hib_user_email 
        add constraint UK_isuygi7fmcwnlht8f4plckt6n  unique (email);
    create index index_to_search_email_by_user on hib_user_email (user_id);
    alter table hib_authentication 
        add constraint authentication_belongs_to_user 
        foreign key (user_id) 
        references hib_user (id);
    alter table hib_user_email 
        add constraint email_belongs_to_user 
        foreign key (user_id) 
        references hib_user (id);

4

0 回答 0