use of com.haulmont.cuba.core.entity.AccessToken in project cuba by cuba-platform.
the class ServerTokenStoreImpl method storeAccessTokenToDatabase.
protected void storeAccessTokenToDatabase(String tokenValue, byte[] accessTokenBytes, String authenticationKey, byte[] authenticationBytes, Date tokenExpiry, String userLogin, @Nullable Locale locale, @Nullable String refreshTokenValue) {
try (Transaction tx = persistence.getTransaction()) {
EntityManager em = persistence.getEntityManager();
AccessToken accessToken = metadata.create(AccessToken.class);
accessToken.setCreateTs(timeSource.currentTimestamp());
accessToken.setTokenValue(tokenValue);
accessToken.setTokenBytes(accessTokenBytes);
accessToken.setAuthenticationKey(authenticationKey);
accessToken.setAuthenticationBytes(authenticationBytes);
accessToken.setExpiry(tokenExpiry);
accessToken.setUserLogin(userLogin);
accessToken.setLocale(locale != null ? locale.toString() : null);
accessToken.setRefreshTokenValue(refreshTokenValue);
em.persist(accessToken);
tx.commit();
}
}
Aggregations