/** * @deprecated use {@link #getAppOwner()} instead. */ @Deprecated public AuthenticatedUser getUser() { return this.getAppOwner(); }
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 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 boolean validateUserForOwnerUpdate(OAuthAppDO oAuthAppDO) throws IdentityOAuthAdminException { try { String userName = null; String usernameWithDomain = null; if (oAuthAppDO.getAppOwner() != null) { userName = oAuthAppDO.getAppOwner().getUserName(); if (StringUtils.isEmpty(userName) || CarbonConstants.REGISTRY_SYSTEM_USERNAME.equals(userName)) { return false; } String domainName = oAuthAppDO.getAppOwner().getUserStoreDomain(); usernameWithDomain = UserCoreUtil.addDomainToName(userName, domainName); } UserRealm realm = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm(); if (realm == null || StringUtils.isEmpty(usernameWithDomain)) { return false; } boolean isUserExist = realm.getUserStoreManager().isExistingUser(usernameWithDomain); if (!isUserExist) { throw new IdentityOAuthAdminException("User validation failed for owner update in the application: " + oAuthAppDO.getApplicationName() + " as user is not existing."); } } catch (UserStoreException e) { throw handleError("User validation failed for owner update in the application: " + oAuthAppDO.getApplicationName(), e); } return true; }