Skip to content

Commit

Permalink
storing tokens in mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
Naresh Bafna committed Jul 30, 2013
1 parent 874c12b commit 51c97ba
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
54 changes: 54 additions & 0 deletions db.sql
@@ -0,0 +1,54 @@
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)
);

create table oauth_client_token (
token_id VARCHAR(256),
token BLOB,
authentication_id VARCHAR(256),
user_name VARCHAR(256),
client_id VARCHAR(256)
);

create table oauth_access_token (
token_id VARCHAR(256),
token BLOB,
authentication_id VARCHAR(256),
user_name VARCHAR(256),
client_id VARCHAR(256),
authentication BLOB,
refresh_token VARCHAR(256)
);

create table oauth_refresh_token (
token_id VARCHAR(256),
token BLOB,
authentication BLOB
);

create table oauth_code (
code VARCHAR(256), authentication BLOB
);

-- 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)
);
13 changes: 12 additions & 1 deletion sparklr/src/main/webapp/WEB-INF/spring-servlet.xml
Expand Up @@ -116,7 +116,18 @@
<constructor-arg ref="clientDetails" />
</bean>

<bean id="tokenStore" class="org.springframework.security.oauth2.provider.token.InMemoryTokenStore" />
<bean id="tokenStore" class="org.springframework.security.oauth2.provider.token.JdbcTokenStore">
<constructor-arg ref="jdbcTemplate" />
</bean>

<bean id="jdbcTemplate"

This comment has been minimized.

Copy link
@Tataraovoleti

Tataraovoleti May 12, 2020

It would be good, if the bean id is dataSource instead of jdbcTemplate. I initially thought why JdbcTokenStore expecting jdbcTemplate ?. Just confused.

class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/oauthdb"/>
<property name="username" value="root"/>
<property name="password" value=""/>
</bean>


<bean id="tokenServices" class="org.springframework.security.oauth2.provider.token.DefaultTokenServices">
<property name="tokenStore" ref="tokenStore" />
Expand Down

0 comments on commit 51c97ba

Please sign in to comment.