Last active
September 16, 2015 08:03
-
-
Save alxsimo/7848317d82224b5140df to your computer and use it in GitHub Desktop.
[Spring/Java] OAuth2 token in database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <bean id="tokenStore" class="org.springframework.security.oauth2.provider.token.JdbcTokenStore"> | |
| <constructor-arg ref="dataSource" /> | |
| </bean> | |
| <bean id="tokenServices" class="org.springframework.security.oauth2.provider.token.DefaultTokenServices"> | |
| <property name="tokenStore" ref="tokenStore" /> | |
| </bean> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- used in tests that use HSQL | |
| create table oauth_client_details ( | |
| client_id VARCHAR(256) PRIMARY KEY, | |
| resource_ids VARCHAR(256), | |
| client_secret VARCHAR(256), | |
| scope VARCHAR(256), | |
| authorized_grant_types VARCHAR(256), | |
| web_server_redirect_uri VARCHAR(256), | |
| authorities VARCHAR(256), | |
| access_token_validity INTEGER, | |
| refresh_token_validity INTEGER, | |
| additional_information VARCHAR(4096), | |
| autoapprove VARCHAR(256) | |
| ); | |
| create table oauth_client_token ( | |
| token_id VARCHAR(256), | |
| token LONGVARBINARY, | |
| authentication_id VARCHAR(256) PRIMARY KEY, | |
| user_name VARCHAR(256), | |
| client_id VARCHAR(256) | |
| ); | |
| create table oauth_access_token ( | |
| token_id VARCHAR(256), | |
| token LONGVARBINARY, | |
| authentication_id VARCHAR(256) PRIMARY KEY, | |
| user_name VARCHAR(256), | |
| client_id VARCHAR(256), | |
| authentication LONGVARBINARY, | |
| refresh_token VARCHAR(256) | |
| ); | |
| create table oauth_refresh_token ( | |
| token_id VARCHAR(256), | |
| token LONGVARBINARY, | |
| authentication LONGVARBINARY | |
| ); | |
| create table oauth_code ( | |
| code VARCHAR(256), authentication LONGVARBINARY | |
| ); | |
| create table oauth_approvals ( | |
| userId VARCHAR(256), | |
| clientId VARCHAR(256), | |
| scope VARCHAR(256), | |
| status VARCHAR(10), | |
| expiresAt TIMESTAMP, | |
| lastModifiedAt TIMESTAMP | |
| ); | |
| -- customized oauth_client_details table | |
| create table ClientDetails ( | |
| appId VARCHAR(256) PRIMARY KEY, | |
| resourceIds VARCHAR(256), | |
| appSecret VARCHAR(256), | |
| scope VARCHAR(256), | |
| grantTypes VARCHAR(256), | |
| redirectUrl VARCHAR(256), | |
| authorities VARCHAR(256), | |
| access_token_validity INTEGER, | |
| refresh_token_validity INTEGER, | |
| additionalInformation VARCHAR(4096), | |
| autoApproveScopes VARCHAR(256) | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DROP TABLE "ARTICA"."oauth_client_details"; | |
| CREATE TABLE "ARTICA"."oauth_client_details" ( | |
| client_id VARCHAR(256) PRIMARY KEY NOT NULL, | |
| resource_ids VARCHAR(256), | |
| client_secret VARCHAR(256), | |
| scope VARCHAR(256), | |
| authorized_grant_types VARCHAR(256), | |
| web_server_redirect_uri VARCHAR(256), | |
| authorities VARCHAR(256), | |
| access_token_validity INTEGER, | |
| refresh_token_validity INTEGER, | |
| additional_information VARCHAR(4096), | |
| autoapprove VARCHAR(256) | |
| ); | |
| DROP TABLE "ARTICA"."oauth_client_token"; | |
| CREATE TABLE "ARTICA"."oauth_client_token" ( | |
| token_id VARCHAR(256), | |
| token LONG VARCHAR FOR BIT DATA, | |
| authentication_id VARCHAR(256) PRIMARY KEY NOT NULL, | |
| user_name VARCHAR(256), | |
| client_id VARCHAR(256) | |
| ); | |
| DROP TABLE "ARTICA"."oauth_access_token"; | |
| CREATE TABLE "ARTICA"."oauth_access_token" ( | |
| token_id VARCHAR(256), | |
| token LONG VARCHAR FOR BIT DATA, | |
| authentication_id VARCHAR(256) PRIMARY KEY NOT NULL, | |
| user_name VARCHAR(256), | |
| client_id VARCHAR(256), | |
| authentication LONG VARCHAR FOR BIT DATA, | |
| refresh_token VARCHAR(256) | |
| ); | |
| DROP TABLE "ARTICA"."oauth_refresh_token"; | |
| CREATE TABLE "ARTICA"."oauth_refresh_token" ( | |
| token_id VARCHAR(256), | |
| token LONG VARCHAR FOR BIT DATA, | |
| authentication LONG VARCHAR FOR BIT DATA | |
| ); | |
| DROP TABLE "ARTICA"."oauth_code"; | |
| CREATE TABLE "ARTICA"."oauth_code" ( | |
| code VARCHAR(256), authentication LONG VARCHAR FOR BIT DATA | |
| ); | |
| DROP TABLE "ARTICA"."oauth_approvals"; | |
| CREATE TABLE "ARTICA"."oauth_approvals" ( | |
| userId VARCHAR(256), | |
| clientId VARCHAR(256), | |
| scope VARCHAR(256), | |
| status VARCHAR(10), | |
| expiresAt TIMESTAMP, | |
| lastModifiedAt TIMESTAMP | |
| ); | |
| -- customized oauth_client_details table | |
| DROP TABLE "ARTICA"."ClientDetails" | |
| CREATE TABLE "ARTICA"."ClientDetails" ( | |
| appId VARCHAR(256) PRIMARY KEY NOT NULL, | |
| resourceIds VARCHAR(256), | |
| appSecret VARCHAR(256), | |
| scope VARCHAR(256), | |
| grantTypes VARCHAR(256), | |
| redirectUrl VARCHAR(256), | |
| authorities VARCHAR(256), | |
| access_token_validity INTEGER, | |
| refresh_token_validity INTEGER, | |
| additionalInformation VARCHAR(4096), | |
| autoApproveScopes VARCHAR(256) | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment