/** * Registers an consumer secret against the logged in user. A given user can only have a single * consumer secret at a time. Calling this method again and again will update the existing * consumer secret key. * * @return An array containing the consumer key and the consumer secret correspondingly. * @throws IdentityOAuthAdminException Error when persisting the data in the persistence store. */ public String[] registerOAuthConsumer() throws IdentityOAuthAdminException { String loggedInUser = CarbonContext.getThreadLocalCarbonContext().getUsername(); if (log.isDebugEnabled()) { log.debug("Adding a consumer secret for the logged in user " + loggedInUser); } String tenantUser = MultitenantUtils.getTenantAwareUsername(loggedInUser); int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); String userDomain = IdentityUtil.extractDomainFromName(loggedInUser); OAuthAppDAO dao = new OAuthAppDAO(); return dao.addOAuthConsumer(UserCoreUtil.removeDomainFromName(tenantUser), tenantId, userDomain); }
/** * Registers an consumer secret against the logged in user. A given user can only have a single * consumer secret at a time. Calling this method again and again will update the existing * consumer secret key. * * @return An array containing the consumer key and the consumer secret correspondingly. * @throws Exception Error when persisting the data in the persistence store. */ public String[] registerOAuthConsumer() throws IdentityOAuthAdminException { String loggedInUser = CarbonContext.getThreadLocalCarbonContext().getUsername(); if (log.isDebugEnabled()) { log.debug("Adding a consumer secret for the logged in user " + loggedInUser); } String tenantUser = MultitenantUtils.getTenantAwareUsername(loggedInUser); int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); String userDomain = IdentityUtil.extractDomainFromName(loggedInUser); OAuthAppDAO dao = new OAuthAppDAO(); return dao.addOAuthConsumer(UserCoreUtil.removeDomainFromName(tenantUser), tenantId, userDomain); }