/** * Add a trusted service to which tokens are issued with given claims. * * @param realmName - this uniquely represents the trusted service * @param claimDialect - claim dialects uris * @param claims - these comma separated default claims are issued when a request is done from the given realm * @throws Exception - if fails to add trusted service */ public void addTrustedService(String realmName, String claimDialect, String claims) throws Exception { realmName = replaceSlashWithConstantString(realmName); try { Registry registry = IdentityPassiveSTSServiceComponent.getConfigSystemRegistry(); String trustedServicePath = registryTrustedServicePath + realmName; // if registry collection does not exists, create if (!registry.resourceExists(trustedServicePath)) { Resource resource = registry.newResource(); resource.addProperty(REALM_NAME, realmName); resource.addProperty(CLAIMS, claims); resource.addProperty(CLAIM_DIALECT, claimDialect); registry.put(trustedServicePath, resource); } else { throw new Exception(realmName + " already added. Please remove first and add again."); } } catch (RegistryException e) { String error = "Error occurred when adding a trusted service due to error in accessing registry."; throw new Exception(error, e); } }
/** * Add a trusted service to which tokens are issued with given claims. * * @param realmName - this uniquely represents the trusted service * @param claimDialect - claim dialects uris * @param claims - these comma separated default claims are issued when a request is done from the given realm * @throws Exception - if fails to add trusted service */ public void addTrustedService(String realmName, String claimDialect, String claims) throws Exception { realmName = replaceSlashWithConstantString(realmName); try { Registry registry = IdentityPassiveSTSServiceComponent.getConfigSystemRegistry(); String trustedServicePath = registryTrustedServicePath + realmName; // if registry collection does not exists, create if (!registry.resourceExists(trustedServicePath)) { Resource resource = registry.newResource(); resource.addProperty(REALM_NAME, realmName); resource.addProperty(CLAIMS, claims); resource.addProperty(CLAIM_DIALECT, claimDialect); registry.put(trustedServicePath, resource); } else { throw new Exception(realmName + " already added. Please remove first and add again."); } } catch (RegistryException e) { String error = "Error occurred when adding a trusted service due to error in accessing registry."; throw new Exception(error, e); } }