Spring OAuth2 JDBCTokenStore performance and database schema

I am using MySQL5.5 + REST (Jersey) + Spring Security + Spring OAuth2. I am currently doing performance testing and notice that

org.springframework.security.oauth2.provider.token.store.JdbcTokenStore.readAuthentication

is very slow .. especially this part of the method:

authentication = jdbcTemplate.queryForObject(selectAccessTokenAuthenticationSql,
                    new RowMapper<OAuth2Authentication>() {
                        public OAuth2Authentication mapRow(ResultSet rs, int rowNum) throws SQLException {
                            return deserializeAuthentication(rs.getBytes(2));
                        }
                    }, extractTokenKey(token));

      

To improve performance, I'm going to add a MySQL index to the following query:

private static final String DEFAULT_ACCESS_TOKEN_AUTHENTICATION_SELECT_STATEMENT = "select token_id, authentication from oauth_access_token where token_id = ?";

      

on token_id

, but the main problem is that regarding the official oauth2 Spring database schema like https://github.com/spring-projects/spring-security-oauth/blob/master/spring-security-oauth2/src/ test / resources / schema.sql

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)
);

      

token_id

is VARCHAR(256)

also due to MySQL bugs or limitations. I cannot add this index (for example The specified MySQL key was too long ) ..

So my question is, is token_id

how mandatory VARCHAR(256)

or can I change it to VARCHAR(255)

?

+3
spring spring-security spring-security-oauth2 mysql oauth-2.0


source to share


No one has answered this question yet

See similar questions:

2
MySQL key specified is too long
1
Spring Oauth2.0 performance issue under heavy load

or similar:

1873
What's the difference between @Component, @Repository and @Service annotations in Spring?
802
How to quickly rename MySQL database (change schema name)?
6
Spring security oauth2: get username in REST webservice
4
Spring OAuth2 PlatformTransactionManager Requirement
2
JdbcTokenStore - poor performance
1
Spring Security 4 + OAuth2 = Bad Credentials
1
Spring Security Authentication Principle as UserDetails
1
Spring security oAuth2 - Implicit token with forms authentication
0
Using Oauth2 in a Single Client Multi-tenant Application
0
Spring OAuth2. 0- saving access_token in the database



All Articles
Loading...
X
Show
Funny
Dev
Pics