private long getRefreshTokenValidityPeriod(long refreshTokenValidityPeriod, OAuthAppDO oAuthAppDO) { // If issuing new refresh token, use default refresh token validity Period // otherwise use existing refresh token's validity period if (refreshTokenValidityPeriod == 0) { if (oAuthAppDO.getRefreshTokenExpiryTime() != 0) { refreshTokenValidityPeriod = oAuthAppDO.getRefreshTokenExpiryTime() * SECONDS_TO_MILISECONDS_FACTOR; } else { refreshTokenValidityPeriod = OAuthServerConfiguration.getInstance() .getRefreshTokenValidityPeriodInSeconds() * SECONDS_TO_MILISECONDS_FACTOR; } } return refreshTokenValidityPeriod; }
private long getRefreshTokenValidityPeriod(String consumerKey, OAuthAppDO oAuthAppBean) { long refreshTokenValidityPeriodInMillis; if (oAuthAppBean.getRefreshTokenExpiryTime() != 0) { refreshTokenValidityPeriodInMillis = oAuthAppBean.getRefreshTokenExpiryTime() * SECONDS_TO_MILISECONDS_FACTOR; if (log.isDebugEnabled()) { log.debug("OAuth application id : " + consumerKey + ", refresh token validity time " + refreshTokenValidityPeriodInMillis + "ms"); } } else { refreshTokenValidityPeriodInMillis = OAuthServerConfiguration.getInstance() .getRefreshTokenValidityPeriodInSeconds() * SECONDS_TO_MILISECONDS_FACTOR; } return refreshTokenValidityPeriodInMillis; }
private static long getConfiguredRefreshTokenValidityPeriodInMillis(OAuthAppDO oAuthAppBean) { long refreshTokenValidityPeriodInMillis; if (oAuthAppBean.getRefreshTokenExpiryTime() != 0) { refreshTokenValidityPeriodInMillis = oAuthAppBean.getRefreshTokenExpiryTime() * SECOND_TO_MILLISECONDS_FACTOR; if (log.isDebugEnabled()) { log.debug("OAuth application id : " + oAuthAppBean.getOauthConsumerKey() + ", using refresh token " + "validity period configured for application: " + refreshTokenValidityPeriodInMillis + " ms"); } } else { refreshTokenValidityPeriodInMillis = OAuthServerConfiguration.getInstance() .getRefreshTokenValidityPeriodInSeconds() * SECOND_TO_MILLISECONDS_FACTOR; if (log.isDebugEnabled()) { log.debug("OAuth application id: " + oAuthAppBean.getOauthConsumerKey() + ", using refresh token " + "validity period configured for server: " + refreshTokenValidityPeriodInMillis + " ms"); } } return refreshTokenValidityPeriodInMillis; }
private void setValuesToStatementWithNoPKCEAndNoOwnerUpdate(OAuthAppDO oauthAppDO, PreparedStatement prepStmt) throws SQLException, IdentityOAuth2Exception { prepStmt.setLong(4, oauthAppDO.getUserAccessTokenExpiryTime()); prepStmt.setLong(5, oauthAppDO.getApplicationAccessTokenExpiryTime()); prepStmt.setLong(6, oauthAppDO.getRefreshTokenExpiryTime()); prepStmt.setLong(7, oauthAppDO.getIdTokenExpiryTime()); prepStmt.setString(8, persistenceProcessor.getProcessedClientId(oauthAppDO.getOauthConsumerKey())); }
private void setValuesToStatementWithPKCENoOwnerUpdate(OAuthAppDO oauthAppDO, PreparedStatement prepStmt) throws SQLException, IdentityOAuth2Exception { prepStmt.setString(4, oauthAppDO.isPkceMandatory() ? "1" : "0"); prepStmt.setString(5, oauthAppDO.isPkceSupportPlain() ? "1" : "0"); prepStmt.setLong(6, oauthAppDO.getUserAccessTokenExpiryTime()); prepStmt.setLong(7, oauthAppDO.getApplicationAccessTokenExpiryTime()); prepStmt.setLong(8, oauthAppDO.getRefreshTokenExpiryTime()); prepStmt.setLong(9, oauthAppDO.getIdTokenExpiryTime()); prepStmt.setString(10, persistenceProcessor.getProcessedClientId(oauthAppDO.getOauthConsumerKey())); }
private OAuthAppDO getoAuthApp(String consumerKey) throws IdentityOAuth2Exception { OAuthAppDO oAuthAppBean; try { oAuthAppBean = OAuth2Util.getAppInformationByClientId(consumerKey); if (log.isDebugEnabled()) { log.debug("Service Provider specific expiry time enabled for application : " + consumerKey + ". Application access token expiry time : " + oAuthAppBean.getApplicationAccessTokenExpiryTime() + ", User access token expiry time : " + oAuthAppBean.getUserAccessTokenExpiryTime() + ", Refresh token expiry time : " + oAuthAppBean.getRefreshTokenExpiryTime()); } } catch (InvalidOAuthClientException e) { throw new IdentityOAuth2Exception("Error while retrieving app information for clientId : " + consumerKey, e); } return oAuthAppBean; }
private void setValuesToStatementWithPKCEAndOwnerUpdate(OAuthAppDO oauthAppDO, PreparedStatement prepStmt) throws SQLException, IdentityOAuth2Exception { prepStmt.setString(4, oauthAppDO.isPkceMandatory() ? "1" : "0"); prepStmt.setString(5, oauthAppDO.isPkceSupportPlain() ? "1" : "0"); prepStmt.setLong(6, oauthAppDO.getUserAccessTokenExpiryTime()); prepStmt.setLong(7, oauthAppDO.getApplicationAccessTokenExpiryTime()); prepStmt.setLong(8, oauthAppDO.getRefreshTokenExpiryTime()); prepStmt.setLong(9, oauthAppDO.getIdTokenExpiryTime()); prepStmt.setString(10, oauthAppDO.getAppOwner().getUserName()); prepStmt.setString(11, oauthAppDO.getAppOwner().getUserStoreDomain()); prepStmt.setString(12, persistenceProcessor.getProcessedClientId(oauthAppDO.getOauthConsumerKey())); }
private void setValuesToStatementWithOwnerUpdateNoPKCE(OAuthAppDO oauthAppDO, PreparedStatement prepStmt) throws SQLException, IdentityOAuth2Exception { prepStmt.setLong(4, oauthAppDO.getUserAccessTokenExpiryTime()); prepStmt.setLong(5, oauthAppDO.getApplicationAccessTokenExpiryTime()); prepStmt.setLong(6, oauthAppDO.getRefreshTokenExpiryTime()); prepStmt.setLong(7, oauthAppDO.getIdTokenExpiryTime()); prepStmt.setString(8, oauthAppDO.getAppOwner().getUserName()); prepStmt.setString(9, oauthAppDO.getAppOwner().getUserStoreDomain()); prepStmt.setString(10, persistenceProcessor.getProcessedClientId(oauthAppDO.getOauthConsumerKey())); }
private static OAuthAppDO getOAuthApp(String consumerKey) throws IdentityOAuth2Exception { OAuthAppDO oAuthAppBean; try { oAuthAppBean = OAuth2Util.getAppInformationByClientId(consumerKey); if (log.isDebugEnabled()) { log.debug("Service Provider specific expiry time enabled for application : " + consumerKey + ". " + "Application access token expiry time : " + oAuthAppBean.getApplicationAccessTokenExpiryTime () + ", User access token expiry time : " + oAuthAppBean.getUserAccessTokenExpiryTime() + ", " + "" + "Refresh token expiry time : " + oAuthAppBean.getRefreshTokenExpiryTime()); } } catch (InvalidOAuthClientException e) { throw new IdentityOAuth2Exception("Error while retrieving app information for clientId : " + consumerKey, e); } return oAuthAppBean; }
private OAuthAppDO getOAuthApp(String clientId) throws IdentityOAuth2Exception { OAuthAppDO oAuthAppDO; try { oAuthAppDO = OAuth2Util.getAppInformationByClientId(clientId); } catch (InvalidOAuthClientException e) { throw new IdentityOAuth2Exception("Error while retrieving app information for clientId: " + clientId, e); } if (log.isDebugEnabled()) { log.debug("Service Provider specific expiry time enabled for application : " + clientId + ". Application access token expiry time : " + oAuthAppDO.getApplicationAccessTokenExpiryTime() + ", User access token expiry time : " + oAuthAppDO.getUserAccessTokenExpiryTime() + ", Refresh token expiry time : " + oAuthAppDO.getRefreshTokenExpiryTime()); } return oAuthAppDO; }
prepStmt.setLong(12, consumerAppDO.getUserAccessTokenExpiryTime()); prepStmt.setLong(13, consumerAppDO.getApplicationAccessTokenExpiryTime()); prepStmt.setLong(14, consumerAppDO.getRefreshTokenExpiryTime()); prepStmt.setLong(15, consumerAppDO.getIdTokenExpiryTime()); prepStmt.execute(); prepStmt.setLong(10, consumerAppDO.getUserAccessTokenExpiryTime()); prepStmt.setLong(11, consumerAppDO.getApplicationAccessTokenExpiryTime()); prepStmt.setLong(12, consumerAppDO.getRefreshTokenExpiryTime()); prepStmt.setLong(13, consumerAppDO.getIdTokenExpiryTime()); prepStmt.execute();
". Application access token expiry time : " + oAuthAppDO.getApplicationAccessTokenExpiryTime() + ", User access token expiry time : " + oAuthAppDO.getUserAccessTokenExpiryTime() + ", Refresh token expiry time : " + oAuthAppDO.getRefreshTokenExpiryTime()); if (oAuthAppDO.getRefreshTokenExpiryTime() != 0) { refreshTokenValidityPeriodInMillis = oAuthAppDO.getRefreshTokenExpiryTime() * 1000; } else { refreshTokenValidityPeriodInMillis = OAuthServerConfiguration.getInstance()
dto.setUserAccessTokenExpiryTime(appDO.getUserAccessTokenExpiryTime()); dto.setApplicationAccessTokenExpiryTime(appDO.getApplicationAccessTokenExpiryTime()); dto.setRefreshTokenExpiryTime(appDO.getRefreshTokenExpiryTime()); dto.setIdTokenExpiryTime(appDO.getIdTokenExpiryTime()); dto.setAudiences(appDO.getAudiences());