Search in sources :

Example 1 with ResolvedSecret

use of org.wso2.carbon.identity.secret.mgt.core.model.ResolvedSecret in project carbon-identity-framework by wso2.

the class SecretResolveManagerImpl method getResolvedSecret.

private ResolvedSecret getResolvedSecret(Secret secret) throws SecretManagementServerException {
    ResolvedSecret resolvedSecret = new ResolvedSecret();
    resolvedSecret.setSecretId(secret.getSecretId());
    resolvedSecret.setSecretName(secret.getSecretName());
    resolvedSecret.setCreatedTime(secret.getCreatedTime());
    resolvedSecret.setLastModified(secret.getLastModified());
    resolvedSecret.setTenantDomain(secret.getTenantDomain());
    resolvedSecret.setResolvedSecretValue(getDecryptedSecretValue(secret.getSecretValue(), secret.getSecretName()));
    return resolvedSecret;
}
Also used : ResolvedSecret(org.wso2.carbon.identity.secret.mgt.core.model.ResolvedSecret)

Example 2 with ResolvedSecret

use of org.wso2.carbon.identity.secret.mgt.core.model.ResolvedSecret in project carbon-identity-framework by wso2.

the class SecretManagerTest method testGetExistingSecretResolved.

@Test(priority = 24)
public void testGetExistingSecretResolved() throws Exception {
    SecretType secretType = secretManager.addSecretType(getSampleSecretTypeAdd(SAMPLE_SECRET_TYPE_NAME1, SAMPLE_SECRET_TYPE_DESCRIPTION1));
    Secret secretAdd = getSampleSecretAdd(SAMPLE_SECRET_NAME1, SAMPLE_SECRET_VALUE1);
    encryptSecret(secretAdd.getSecretValue());
    Secret secretCreated = secretManager.addSecret(secretType.getName(), secretAdd);
    decryptSecret(ENCRYPTED_VALUE1);
    ResolvedSecret secretRetrieved = secretResolveManager.getResolvedSecret(secretType.getName(), SAMPLE_SECRET_NAME1);
    assertEquals(secretCreated.getSecretId(), secretRetrieved.getSecretId(), "Existing id should be equal " + "to the retrieved id");
    assertEquals(SAMPLE_SECRET_VALUE1, secretRetrieved.getResolvedSecretValue(), "Existing id should be equal " + "to the retrieved id");
}
Also used : ResolvedSecret(org.wso2.carbon.identity.secret.mgt.core.model.ResolvedSecret) Secret(org.wso2.carbon.identity.secret.mgt.core.model.Secret) SecretType(org.wso2.carbon.identity.secret.mgt.core.model.SecretType) ResolvedSecret(org.wso2.carbon.identity.secret.mgt.core.model.ResolvedSecret) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

ResolvedSecret (org.wso2.carbon.identity.secret.mgt.core.model.ResolvedSecret)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 Test (org.testng.annotations.Test)1 Secret (org.wso2.carbon.identity.secret.mgt.core.model.Secret)1 SecretType (org.wso2.carbon.identity.secret.mgt.core.model.SecretType)1