spring security oAuth2.0 數據庫說明


話不多說,直接上代碼。

里面每一個字段都有說明,直接將它們放入mysql執行即可添加成功。

create table oauth_access_token
(
    token_id          varchar(256) null comment 'MD5加密的access_token的值',
    token             blob         null comment 'OAuth2AccessToken.java對象序列化后的二進制數據',
    authentication_id varchar(256) not null comment 'MD5加密過的username,client_id,scope'
        primary key,
    user_name         varchar(256) null comment '登錄的用戶名',
    client_id         varchar(256) null comment '客戶端ID',
    authentication    blob         null comment 'OAuth2Authentication.java對象序列化后的二進制數據',
    refresh_token     varchar(256) null comment 'MD5加密后的refresh_token的值'
)
    comment '訪問令牌' charset = utf8;

create table oauth_approvals
(
    userId         varchar(256) null comment '登錄的用戶名',
    clientId       varchar(256) null comment '客戶端ID',
    scope          varchar(256) null comment '申請的權限',
    status         varchar(10)  null comment '狀態(Approve或Deny)',
    expiresAt      datetime     null comment '過期時間',
    lastModifiedAt datetime     null comment '最終修改時間'
)
    comment '授權記錄' charset = utf8;

create table oauth_client_details
(
    client_id               varchar(128)  not null comment '客戶端ID'
        primary key,
    resource_ids            varchar(256)  null comment '資源ID集合,多個資源時用英文逗號分隔',
    client_secret           varchar(256)  null comment '客戶端密匙',
    scope                   varchar(256)  null comment '客戶端申請的權限范圍',
    authorized_grant_types  varchar(256)  null comment '客戶端支持的grant_type',
    web_server_redirect_uri varchar(256)  null comment '重定向URI',
    authorities             varchar(256)  null comment '客戶端所擁有的SpringSecurity的權限值,多個用英文逗號分隔',
    access_token_validity   int           null comment '訪問令牌有效時間值(單位秒)',
    refresh_token_validity  int           null comment '更新令牌有效時間值(單位秒)',
    additional_information  varchar(4096) null comment '預留字段',
    autoapprove             varchar(256)  null comment '用戶是否自動Approval操作'
)
    comment '客戶端信息' charset = utf8;

create table oauth_client_token
(
    token_id          varchar(256) null comment 'MD5加密的access_token值',
    token             blob         null comment 'OAuth2AccessToken.java對象序列化后的二進制數據',
    authentication_id varchar(128) not null comment 'MD5加密過的username,client_id,scope'
        primary key,
    user_name         varchar(256) null comment '登錄的用戶名',
    client_id         varchar(256) null comment '客戶端ID'
)
    comment '該表用於在客戶端系統中存儲從服務端獲取的token數據' charset = utf8;

create table oauth_code
(
    code           varchar(256) null comment '授權碼(未加密)',
    authentication blob         null comment 'AuthorizationRequestHolder.java對象序列化后的二進制數據'
)
    comment '授權碼' charset = utf8;

create table oauth_refresh_token
(
    token_id       varchar(256) null comment 'MD5加密過的refresh_token的值',
    token          blob         null comment 'OAuth2RefreshToken.java對象序列化后的二進制數據',
    authentication blob         null comment 'OAuth2Authentication.java對象序列化后的二進制數據'
)
    comment '更新令牌' charset = utf8;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM