use of org.wso2.carbon.identity.api.server.application.management.v1.MetadataProperty in project identity-api-server by wso2.
the class ServerApplicationMetadataService method getSAMLMetadata.
/**
* Pull SAML metadata from the SAMLSSOConfigServiceImpl and return.
*
* @return Populated SAMLMetaData object.
*/
public SAMLMetaData getSAMLMetadata() {
SAMLMetaData samlMetaData = new SAMLMetaData();
SAMLSSOConfigServiceImpl samlSSOConfigService = ApplicationManagementServiceHolder.getSamlssoConfigService();
samlMetaData.setDefaultNameIdFormat(DEFAULT_NAME_ID_FORMAT);
try {
samlMetaData.setCertificateAlias(new MetadataProperty().defaultValue(DEFAULT_CERTIFICATE_ALIAS).options(Arrays.asList(samlSSOConfigService.getCertAliasOfPrimaryKeyStore())));
} catch (IdentityException e) {
throw handleException(e);
}
samlMetaData.setResponseSigningAlgorithm(new MetadataProperty().defaultValue(samlSSOConfigService.getSigningAlgorithmUriByConfig()).options(Arrays.asList(samlSSOConfigService.getSigningAlgorithmUris())));
samlMetaData.setResponseDigestAlgorithm(new MetadataProperty().defaultValue(samlSSOConfigService.getDigestAlgorithmURIByConfig()).options(Arrays.asList(samlSSOConfigService.getDigestAlgorithmURIs())));
samlMetaData.setAssertionEncryptionAlgorithm(new MetadataProperty().defaultValue(samlSSOConfigService.getAssertionEncryptionAlgorithmURIByConfig()).options(Arrays.asList(samlSSOConfigService.getAssertionEncryptionAlgorithmURIs())));
samlMetaData.setKeyEncryptionAlgorithm(new MetadataProperty().defaultValue(samlSSOConfigService.getKeyEncryptionAlgorithmURIByConfig()).options(Arrays.asList(samlSSOConfigService.getKeyEncryptionAlgorithmURIs())));
return samlMetaData;
}
use of org.wso2.carbon.identity.api.server.application.management.v1.MetadataProperty in project identity-api-server by wso2.
the class ServerApplicationMetadataService method getOIDCMetadata.
/**
* Pull OAuth/OIDC Metadata from OAuthAdminServiceImpl and return.
*
* @return Populated OIDCMetadata object.
*/
public OIDCMetaData getOIDCMetadata() {
OIDCMetaData oidcMetaData = new OIDCMetaData();
OAuthAdminServiceImpl oAuthAdminService = ApplicationManagementServiceHolder.getOAuthAdminService();
List<String> supportedGrantTypes = new LinkedList<>(Arrays.asList(oAuthAdminService.getAllowedGrantTypes()));
List<GrantType> supportedGrantTypeNames = new ArrayList<>();
// Iterate through the standard grant type names and add matching elements.
for (String supportedGrantTypeName : supportedGrantTypes) {
GrantType grantType = new GrantType();
if (getOAuthGrantTypeNames().keySet().contains(supportedGrantTypeName)) {
grantType.setName(supportedGrantTypeName);
grantType.setDisplayName(getOAuthGrantTypeNames().get(supportedGrantTypeName));
} else {
grantType.setName(supportedGrantTypeName);
grantType.setDisplayName(supportedGrantTypeName);
}
supportedGrantTypeNames.add(grantType);
}
// Set extracted grant types.
oidcMetaData.setAllowedGrantTypes(new GrantTypeMetaData().options(supportedGrantTypeNames));
oidcMetaData.setDefaultUserAccessTokenExpiryTime(String.valueOf(oAuthAdminService.getTokenExpiryTimes().getUserAccessTokenExpiryTime()));
oidcMetaData.defaultApplicationAccessTokenExpiryTime(String.valueOf(oAuthAdminService.getTokenExpiryTimes().getApplicationAccessTokenExpiryTime()));
oidcMetaData.defaultRefreshTokenExpiryTime(String.valueOf(oAuthAdminService.getTokenExpiryTimes().getRefreshTokenExpiryTime()));
oidcMetaData.defaultIdTokenExpiryTime(String.valueOf(oAuthAdminService.getTokenExpiryTimes().getIdTokenExpiryTime()));
OAuthIDTokenAlgorithmDTO idTokenAlgorithmDTO = oAuthAdminService.getSupportedIDTokenAlgorithms();
oidcMetaData.setIdTokenEncryptionAlgorithm(new MetadataProperty().defaultValue(idTokenAlgorithmDTO.getDefaultIdTokenEncryptionAlgorithm()).options(idTokenAlgorithmDTO.getSupportedIdTokenEncryptionAlgorithms()));
oidcMetaData.idTokenEncryptionMethod(new MetadataProperty().defaultValue(idTokenAlgorithmDTO.getDefaultIdTokenEncryptionMethod()).options(idTokenAlgorithmDTO.getSupportedIdTokenEncryptionMethods()));
oidcMetaData.setScopeValidators(new MetadataProperty().defaultValue(null).options(Arrays.asList(oAuthAdminService.getAllowedScopeValidators())));
oidcMetaData.accessTokenType(new MetadataProperty().defaultValue(oAuthAdminService.getDefaultTokenType()).options(oAuthAdminService.getSupportedTokenTypes()));
List<TokenBindingMetaDataDTO> supportedTokenBindings = oAuthAdminService.getSupportedTokenBindingsMetaData();
List<String> supportedTokenBindingTypes = new ArrayList<>();
supportedTokenBindingTypes.add("None");
for (TokenBindingMetaDataDTO tokenBindingDTO : supportedTokenBindings) {
supportedTokenBindingTypes.add(tokenBindingDTO.getTokenBindingType());
}
oidcMetaData.setAccessTokenBindingType(new MetadataProperty().defaultValue("None").options(supportedTokenBindingTypes));
return oidcMetaData;
}
Aggregations