/** * Get the tenant domain of an oauth application * * @param oAuthAppDO * @return */ public static String getTenantDomainOfOauthApp(OAuthAppDO oAuthAppDO) { String tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; if (oAuthAppDO != null) { AuthenticatedUser appDeveloper = oAuthAppDO.getUser(); tenantDomain = appDeveloper.getTenantDomain(); } return tenantDomain; }
public void addOAuthApplication(OAuthAppDO consumerAppDO) throws IdentityOAuthAdminException { int spTenantId = IdentityTenantUtil.getTenantId(consumerAppDO.getUser().getTenantDomain()); String userStoreDomain = consumerAppDO.getUser().getUserStoreDomain(); if (!isDuplicateApplication(consumerAppDO.getUser().getUserName(), spTenantId, userStoreDomain, consumerAppDO)) { int appId = 0; prepStmt.setString(1, processedClientId); prepStmt.setString(2, processedClientSecret); prepStmt.setString(3, consumerAppDO.getUser().getUserName()); prepStmt.setInt(4, spTenantId); prepStmt.setString(5, userStoreDomain); prepStmt.setString(1, processedClientId); prepStmt.setString(2, processedClientSecret); prepStmt.setString(3, consumerAppDO.getUser().getUserName()); prepStmt.setInt(4, spTenantId); prepStmt.setString(5, userStoreDomain); consumerAppDO.getApplicationName(), consumerAppDO.getUser().getTenantDomain()), e); } catch (IdentityOAuth2Exception e) { throw handleError("Error occurred while processing the client id and client secret by " +
/** * Get the tenant domain of an oauth application * * @param oAuthAppDO * @return */ public static String getTenantDomainOfOauthApp(OAuthAppDO oAuthAppDO) { String tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; if (oAuthAppDO != null) { AuthenticatedUser appDeveloper = oAuthAppDO.getUser(); tenantDomain = appDeveloper.getTenantDomain(); } return tenantDomain; }
dto.setGrantTypes(appDO.getGrantTypes()); dto.setScopeValidators(appDO.getScopeValidators()); dto.setUsername(appDO.getUser().toFullQualifiedUsername()); dto.setState(appDO.getState()); dto.setPkceMandatory(appDO.isPkceMandatory());
/** * Unmarshal oauth application to string. * * @param authApplication oauth application to be marshaled * @return string * @throws IdentityApplicationManagementException Identity Application Management Exception */ private String unmarshelOAuthDO(OAuthAppDO authApplication) throws IdentityApplicationManagementException { try { JAXBContext jaxbContext = JAXBContext.newInstance(OAuthAppDO.class); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); StringWriter sw = new StringWriter(); jaxbMarshaller.marshal(authApplication, sw); return sw.toString(); } catch (JAXBException e) { throw new IdentityApplicationManagementException(String.format("Error in exporting OAuth application " + "%s@%s", authApplication.getApplicationName(), authApplication.getUser().getTenantDomain()), e); } }
PreparedStatement prepStmt = null; if (!isDuplicateApplication(consumerAppDO.getUser().getUserName(), IdentityTenantUtil.getTenantId(consumerAppDO .getUser().getTenantDomain()), consumerAppDO.getUser().getUserStoreDomain(), consumerAppDO)) { prepStmt.setString(1, persistenceProcessor.getProcessedClientId(consumerAppDO.getOauthConsumerKey())); prepStmt.setString(2, persistenceProcessor.getProcessedClientSecret(consumerAppDO.getOauthConsumerSecret())); prepStmt.setString(3, consumerAppDO.getUser().getUserName()); prepStmt.setInt(4, IdentityTenantUtil.getTenantId(consumerAppDO.getUser().getTenantDomain())); prepStmt.setString(5, consumerAppDO.getUser().getUserStoreDomain()); prepStmt.setString(6, consumerAppDO.getApplicationName()); prepStmt.setString(7, consumerAppDO.getOauthVersion()); prepStmt.setString(1, persistenceProcessor.getProcessedClientId(consumerAppDO.getOauthConsumerKey())); prepStmt.setString(2, persistenceProcessor.getProcessedClientSecret(consumerAppDO.getOauthConsumerSecret())); prepStmt.setString(3, consumerAppDO.getUser().getUserName()); prepStmt.setInt(4, IdentityTenantUtil.getTenantId(consumerAppDO.getUser().getTenantDomain())); prepStmt.setString(5, consumerAppDO.getUser().getUserStoreDomain()); prepStmt.setString(6, consumerAppDO.getApplicationName()); prepStmt.setString(7, consumerAppDO.getOauthVersion());
String spTenantDomain = oauthAppDO.getUser().getTenantDomain(); int spTenantId = IdentityTenantUtil.getTenantId(spTenantDomain);
OAuth2Util.setClientTenatId(IdentityTenantUtil.getTenantId(appDO.getUser().getTenantDomain()));
throw new IdentityOAuth2Exception(e.getMessage()); String subscriber = appDO.getUser().toString(); String applicationName = appDO.getApplicationName();
appDTO.setOauthConsumerKey(scopedToken.getConsumerKey()); appDTO.setApplicationName(appDO.getApplicationName()); appDTO.setUsername(appDO.getUser().toString()); appDTO.setGrantTypes(appDO.getGrantTypes()); appDTO.setPkceMandatory(appDO.isPkceMandatory());
OAuth2Util.setClientTenatId(IdentityTenantUtil.getTenantId(appDO.getUser().getTenantDomain()));
throw new IdentityOAuth2Exception(e.getMessage()); String subscriber = appDO.getUser().toString(); String applicationName = appDO.getApplicationName();
.getConsumerKey()).getUser().getTenantDomain(); } else if (tokenContext != null) { tenantDomain = tokenContext.getAuthorizedUser().getTenantDomain();
tokReqMsgCtx.setAuthorizedUser(oAuthAppDO.getUser());
tokReqMsgCtx.setAuthorizedUser(oAuthAppDO.getUser());
dto.setOAuthVersion(app.getOauthVersion()); dto.setGrantTypes(app.getGrantTypes()); dto.setUsername(app.getUser().toString()); dto.setPkceMandatory(app.isPkceMandatory()); dto.setPkceSupportPlain(app.isPkceSupportPlain());