org.wso2.carbon.identity.application.common.model.Property Java Examples
The following examples show how to use
org.wso2.carbon.identity.application.common.model.Property.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApplicationMgtValidator.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
/** * Validate request path authenticator related configurations and append to the validation msg list. * * @param validationMsg validation error messages * @param requestPathAuthenticatorConfigs request path authentication config * @param tenantDomain tenant domain * @throws IdentityApplicationManagementException Identity Application Management Exception when unable to get the * authenticator params */ private void validateRequestPathAuthenticationConfig(List<String> validationMsg, RequestPathAuthenticatorConfig[] requestPathAuthenticatorConfigs, String tenantDomain) throws IdentityApplicationManagementException { ApplicationManagementService applicationMgtService = ApplicationManagementService.getInstance(); Map<String, Property[]> allRequestPathAuthenticators = Arrays.stream(applicationMgtService .getAllRequestPathAuthenticators(tenantDomain)) .collect(Collectors.toMap(RequestPathAuthenticatorConfig::getName, RequestPathAuthenticatorConfig::getProperties)); if (requestPathAuthenticatorConfigs != null) { for (RequestPathAuthenticatorConfig config : requestPathAuthenticatorConfigs) { if (!allRequestPathAuthenticators.containsKey(config.getName())) { validationMsg.add(String.format(AUTHENTICATOR_NOT_AVAILABLE, config.getName())); } } } }
Example #2
Source File: IdentityApplicationManagementUtil.java From carbon-identity with Apache License 2.0 | 6 votes |
public static Property getProperty(Property[] properties, String propertyName) { if (ArrayUtils.isEmpty(properties) || StringUtils.isBlank(propertyName)) { return null; } for (Property property : properties) { if (property == null) { continue; } if (propertyName.equals(property.getName())) { return property; } } return null; }
Example #3
Source File: RandomPasswordProcessor.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * Remove random passwords with original passwords when sending password properties to Service Back-end * @param properties */ public Property[] removeRandomPasswords(Property[] properties, boolean withCacheClear) { if (ArrayUtils.isEmpty(properties)) { return new Property[0]; } String uuid = IdentityApplicationManagementUtil.getPropertyValue(properties, IdentityApplicationConstants.UNIQUE_ID_CONSTANT); if (StringUtils.isBlank(uuid)) { if (log.isDebugEnabled()) { log.debug("Cache Key not found for Random Password Container"); } } else { properties = removeUniqueIdProperty(properties); RandomPassword[] randomPasswords = getRandomPasswordContainerFromCache(uuid, withCacheClear); if (!ArrayUtils.isEmpty(randomPasswords)) { replaceRandomPasswordsWithOriginalPasswords(properties, randomPasswords); } } return properties; }
Example #4
Source File: ServerIdpManagementService.java From identity-api-server with Apache License 2.0 | 6 votes |
/** * Create internal federated authenticator config from external federated authenticator PUT request. * * @param federatedAuthenticatorId Federated authenticator ID. * @param authenticator Internal federated authenticator config. * @return Federated authenticator config of the specified ID. */ private FederatedAuthenticatorConfig createFederatedAuthenticatorConfig(String federatedAuthenticatorId, FederatedAuthenticatorPUTRequest authenticator) { FederatedAuthenticatorConfig authConfig = new FederatedAuthenticatorConfig(); String authenticatorName = base64URLDecode(federatedAuthenticatorId); authConfig.setName(authenticatorName); authConfig.setDisplayName(getDisplayNameOfAuthenticator(authenticatorName)); authConfig.setEnabled(authenticator.getIsEnabled()); List<org.wso2.carbon.identity.api.server.idp.v1.model.Property> authProperties = authenticator.getProperties(); if (IdentityApplicationConstants.Authenticator.SAML2SSO.FED_AUTH_NAME.equals(authenticatorName)) { validateSamlMetadata(authProperties); } List<Property> properties = authProperties.stream().map(propertyToInternal).collect(Collectors.toList()); authConfig.setProperties(properties.toArray(new Property[0])); return authConfig; }
Example #5
Source File: IdPManagementUtil.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
/** * Use this method to replace original passwords with random passwords before sending to UI front-end * @param identityProvider * @return */ public static void removeOriginalPasswords(IdentityProvider identityProvider) { if (identityProvider == null || identityProvider.getProvisioningConnectorConfigs() == null) { return; } for (ProvisioningConnectorConfig provisioningConnectorConfig : identityProvider .getProvisioningConnectorConfigs()) { Property[] properties = provisioningConnectorConfig.getProvisioningProperties(); if (ArrayUtils.isEmpty(properties)) { continue; } properties = RandomPasswordProcessor.getInstance().removeOriginalPasswords(properties); provisioningConnectorConfig.setProvisioningProperties(properties); } }
Example #6
Source File: IdPManagementUtil.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
/** * Use this method to replace random passwords with original passwords when original passwords are required * @param identityProvider * @param withCacheClear */ public static void removeRandomPasswords(IdentityProvider identityProvider, boolean withCacheClear) { if (identityProvider == null || identityProvider.getProvisioningConnectorConfigs() == null) { return; } for (ProvisioningConnectorConfig provisioningConnectorConfig : identityProvider .getProvisioningConnectorConfigs()) { Property[] properties = provisioningConnectorConfig.getProvisioningProperties(); if (ArrayUtils.isEmpty(properties)) { continue; } properties = RandomPasswordProcessor.getInstance().removeRandomPasswords(properties, withCacheClear); provisioningConnectorConfig.setProvisioningProperties(properties); } }
Example #7
Source File: ServerIdentityGovernanceService.java From identity-api-server with Apache License 2.0 | 6 votes |
private ConnectorRes buildConnectorResDTO(ConnectorConfig connectorConfig) { ConnectorRes connectorsResDTO = new ConnectorRes(); connectorsResDTO.setId(Base64.getUrlEncoder() .withoutPadding() .encodeToString(connectorConfig.getName().getBytes(StandardCharsets.UTF_8))); connectorsResDTO.setName(connectorConfig.getName()); connectorsResDTO.setFriendlyName(connectorConfig.getFriendlyName()); connectorsResDTO.setCategory(connectorConfig.getCategory()); connectorsResDTO.setSubCategory(connectorConfig.getSubCategory()); connectorsResDTO.setOrder(connectorConfig.getOrder()); List<PropertyRes> properties = new ArrayList<>(); for (Property property : connectorConfig.getProperties()) { PropertyRes propertyRes = new PropertyRes(); propertyRes.setName(property.getName()); propertyRes.setValue(property.getValue()); propertyRes.setDisplayName(property.getDisplayName()); propertyRes.setDescription(property.getDescription() != null ? property.getDescription() : ""); properties.add(propertyRes); } connectorsResDTO.setProperties(properties); return connectorsResDTO; }
Example #8
Source File: FrameworkUtils.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * @param externalIdPConfig * @param name * @return */ public static Map<String, String> getAuthenticatorPropertyMapFromIdP( ExternalIdPConfig externalIdPConfig, String name) { Map<String, String> propertyMap = new HashMap<String, String>(); if (externalIdPConfig != null) { FederatedAuthenticatorConfig[] authenticatorConfigs = externalIdPConfig .getIdentityProvider().getFederatedAuthenticatorConfigs(); for (FederatedAuthenticatorConfig authenticatorConfig : authenticatorConfigs) { if (authenticatorConfig.getName().equals(name)) { for (Property property : authenticatorConfig.getProperties()) { propertyMap.put(property.getName(), property.getValue()); } break; } } } return propertyMap; }
Example #9
Source File: FileBasedIdPMgtDAO.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
public IdentityProvider getIdPByAuthenticatorPropertyValue(String property, String value, String tenantDomain, String authenticatorName) { Map<String, IdentityProvider> identityProviders = IdPManagementServiceComponent.getFileBasedIdPs(); for (Entry<String, IdentityProvider> entry : identityProviders.entrySet()) { FederatedAuthenticatorConfig[] federatedAuthenticatorConfigs = entry.getValue(). getFederatedAuthenticatorConfigs(); // Get SAML2 Web SSO authenticator FederatedAuthenticatorConfig samlAuthenticatorConfig = IdentityApplicationManagementUtil. getFederatedAuthenticator(federatedAuthenticatorConfigs, authenticatorName); if (samlAuthenticatorConfig != null) { Property samlProperty = IdentityApplicationManagementUtil.getProperty(samlAuthenticatorConfig. getProperties(), property); if (samlProperty != null) { if (value.equalsIgnoreCase(samlProperty.getValue())) { return entry.getValue(); } } } } return null; }
Example #10
Source File: RandomPasswordProcessor.java From carbon-identity with Apache License 2.0 | 6 votes |
private Property[] addUniqueIdProperty(Property [] properties) { if (ArrayUtils.isEmpty(properties)){ return new Property[0]; } String uuid = UUID.randomUUID().toString(); Property uniqueIdProperty = new Property(); uniqueIdProperty.setName(IdentityApplicationConstants.UNIQUE_ID_CONSTANT); uniqueIdProperty.setValue(uuid); if (log.isDebugEnabled()){ log.debug("Adding uniqueId property: " + uuid); } properties = (Property[]) ArrayUtils.add(properties, uniqueIdProperty); return properties; }
Example #11
Source File: IdentityProviderManager.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
private void addSSOUrlAsDestinationUrl(FederatedAuthenticatorConfig federatedAuthenticatorConfig, String ssoUrl, List<Property> propertiesList) { // First find the available configured destination URLs. List<Property> destinationURLs = Arrays.stream(federatedAuthenticatorConfig.getProperties()) .filter(property -> property.getName() .startsWith(IdentityApplicationConstants.Authenticator.SAML2SSO.DESTINATION_URL_PREFIX)) .collect(Collectors.toList()); // Check whether the SSO URL is already available as a destination URL boolean isSAMLSSOUrlNotPresentAsDestination = destinationURLs.stream() .noneMatch(x -> StringUtils.equals(ssoUrl, x.getValue())); if (isSAMLSSOUrlNotPresentAsDestination) { // There are no destination properties matching the default SSO URL. int propertyNameIndex = destinationURLs.size() + 1; Property destinationURLProperty = buildDestinationURLProperty(ssoUrl, propertyNameIndex); propertiesList.add(destinationURLProperty); } }
Example #12
Source File: FrameworkUtils.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
/** * Get the configurations of a tenant from cache or database * * @param tenantDomain Domain name of the tenant * @return Configurations belong to the tenant */ private static Property[] getResidentIdpConfiguration(String tenantDomain) throws FrameworkException { IdpManager identityProviderManager = IdentityProviderManager.getInstance(); IdentityProvider residentIdp = null; try { residentIdp = identityProviderManager.getResidentIdP(tenantDomain); } catch (IdentityProviderManagementException e) { String errorMsg = String.format("Error while retrieving resident Idp for %s tenant.", tenantDomain); throw new FrameworkException(errorMsg, e); } IdentityProviderProperty[] identityMgtProperties = residentIdp.getIdpProperties(); Property[] configMap = new Property[identityMgtProperties.length]; int index = 0; for (IdentityProviderProperty identityMgtProperty : identityMgtProperties) { if (ALREADY_WRITTEN_PROPERTY.equals(identityMgtProperty.getName())) { continue; } Property property = new Property(); property.setName(identityMgtProperty.getName()); property.setValue(identityMgtProperty.getValue()); configMap[index] = property; index++; } return configMap; }
Example #13
Source File: FrameworkUtils.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
/** * This method is used to get the requested resident Idp configuration details. * * @param propertyName * @param tenantDomain * @return Property * @throws FrameworkException */ public static Property getResidentIdpConfiguration(String propertyName, String tenantDomain) throws FrameworkException { Property requestedProperty = null; Property[] allProperties = getResidentIdpConfiguration(tenantDomain); for (int i = 0; i < allProperties.length; i++) { if (propertyName.equals(allProperties[i].getName())) { requestedProperty = allProperties[i]; break; } } return requestedProperty; }
Example #14
Source File: RandomPasswordProcessor.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * Remove original passwords with random passwords when sending password properties to UI front-end * @param properties */ public Property[] removeOriginalPasswords(Property[] properties){ if (ArrayUtils.isEmpty(properties)){ return new Property[0]; } properties = addUniqueIdProperty(properties); String uuid = IdentityApplicationManagementUtil .getPropertyValue(properties, IdentityApplicationConstants.UNIQUE_ID_CONSTANT); String randomPhrase = IdentityApplicationConstants.RANDOM_PHRASE_PREFIX + uuid; RandomPassword[] randomPasswords = replaceOriginalPasswordsWithRandomPasswords( randomPhrase, properties); if (!ArrayUtils.isEmpty(randomPasswords)) { addPasswordContainerToCache(randomPasswords, uuid); } return properties; }
Example #15
Source File: FrameworkUtils.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
/** * @param externalIdPConfig * @param name * @return */ public static Map<String, String> getAuthenticatorPropertyMapFromIdP( ExternalIdPConfig externalIdPConfig, String name) { Map<String, String> propertyMap = new HashMap<String, String>(); if (externalIdPConfig != null) { FederatedAuthenticatorConfig[] authenticatorConfigs = externalIdPConfig .getIdentityProvider().getFederatedAuthenticatorConfigs(); for (FederatedAuthenticatorConfig authenticatorConfig : authenticatorConfigs) { if (authenticatorConfig.getName().equals(name)) { for (Property property : authenticatorConfig.getProperties()) { propertyMap.put(property.getName(), property.getValue()); } break; } } } return propertyMap; }
Example #16
Source File: YahooOpenIDAuthenticator.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * Get Configuration Properties * * @return */ @Override public List<Property> getConfigurationProperties() { List<Property> configProperties = new ArrayList<Property>(); Property oauthEndpoint = new Property(); oauthEndpoint.setDisplayName("Yahoo Authentication Endpoint"); oauthEndpoint.setName(YahooOpenIDAuthenticatorConstants.YAHOO_AUTHZ_URL); oauthEndpoint.setValue(IdentityApplicationConstants.YAHOO_AUTHZ_URL); oauthEndpoint.setDescription("Enter value corresponding to yahoo oauth endpoint."); oauthEndpoint.setDisplayOrder(1); configProperties.add(oauthEndpoint); return configProperties; }
Example #17
Source File: RandomPasswordProcessor.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
/** * Remove random passwords with original passwords when sending password properties to Service Back-end * * @param properties */ public Property[] removeRandomPasswords(Property[] properties, boolean withCacheClear) { if (ArrayUtils.isEmpty(properties)) { return new Property[0]; } String uuid = IdentityApplicationManagementUtil.getPropertyValue(properties, IdentityApplicationConstants.UNIQUE_ID_CONSTANT); if (StringUtils.isBlank(uuid)) { if (log.isDebugEnabled()) { log.debug("Cache Key not found for Random Password Container"); } } else { properties = removeUniqueIdProperty(properties); RandomPassword[] randomPasswords = getRandomPasswordContainerFromCache(uuid, withCacheClear); if (!ArrayUtils.isEmpty(randomPasswords)) { replaceRandomPasswordsWithOriginalPasswords(properties, randomPasswords); } } return properties; }
Example #18
Source File: RandomPasswordProcessor.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
private Property[] addUniqueIdProperty(Property[] properties) { if (ArrayUtils.isEmpty(properties)) { return new Property[0]; } String uuid = UUID.randomUUID().toString(); Property uniqueIdProperty = new Property(); uniqueIdProperty.setName(IdentityApplicationConstants.UNIQUE_ID_CONSTANT); uniqueIdProperty.setValue(uuid); if (log.isDebugEnabled()) { log.debug("Adding uniqueId property: " + uuid); } properties = (Property[]) ArrayUtils.add(properties, uniqueIdProperty); return properties; }
Example #19
Source File: RandomPasswordProcessor.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
private Property[] removeUniqueIdProperty(Property[] properties) { if (ArrayUtils.isEmpty(properties)) { return new Property[0]; } for (int i = 0; i < properties.length; i++) { if (properties[i] == null) { continue; } if (IdentityApplicationConstants.UNIQUE_ID_CONSTANT.equals(properties[i].getName())) { Property[] propertiesTemp = properties; if (log.isDebugEnabled()) { log.debug("Removing uniqueId property: " + properties[i].getName()); } properties = (Property[]) ArrayUtils.removeElement(properties, properties[i]); //Removing uniqueId property from existing properties too propertiesTemp[i] = null; } } return properties; }
Example #20
Source File: DefaultAuthSeqMgtServiceImpl.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
private void validateLocalAuthenticatorConfig(List<String> validationMsg, Map<String, Property[]> allLocalAuthenticators, AtomicBoolean isAuthenticatorIncluded, AuthenticationStep authenticationStep) { for (LocalAuthenticatorConfig localAuth : authenticationStep.getLocalAuthenticatorConfigs()) { if (!allLocalAuthenticators.keySet().contains(localAuth.getName())) { validationMsg.add(String.format(AUTHENTICATOR_NOT_AVAILABLE, localAuth.getName())); } else if (!isAuthenticatorIncluded.get()) { Property[] properties = allLocalAuthenticators.get(localAuth.getName()); if (properties.length == 0) { isAuthenticatorIncluded.set(true); } else { for (Property property : properties) { if (!(IS_HANDLER.equals(property.getName()) && Boolean.valueOf(property.getValue()))) { isAuthenticatorIncluded.set(true); } } } } } }
Example #21
Source File: IdentityApplicationManagementUtil.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
public static Property getProperty(Property[] properties, String propertyName) { if (ArrayUtils.isEmpty(properties) || StringUtils.isBlank(propertyName)) { return null; } for (Property property : properties) { if (property == null) { continue; } if (propertyName.equals(property.getName())) { return property; } } return null; }
Example #22
Source File: IdentityApplicationManagementUtil.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * This is used in back end. Property is the type of stub generated property * * @param authnConfigs authenticatorConfigs to iterate * @param authenticatorName authenticator name of which the values are needed * @param propNameStartsWith the prefix of the property name * @return the list of values which statrts with the propNameStartsWith. */ public static List<String> getPropertyValuesForNameStartsWith(FederatedAuthenticatorConfig[] authnConfigs, String authenticatorName, String propNameStartsWith) { List<String> propValueSet = new ArrayList<String>(); for (FederatedAuthenticatorConfig config : authnConfigs) { if (authenticatorName.equals(config.getName())) { for (Property prop : config.getProperties()) { if (prop.getName().startsWith(propNameStartsWith)) { propValueSet.add(prop.getValue()); } } } } return propValueSet; }
Example #23
Source File: IdPManagementUtil.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * Use this method to replace random passwords with original passwords when original passwords are required * @param identityProvider * @param withCacheClear */ public static void removeRandomPasswords(IdentityProvider identityProvider, boolean withCacheClear) { if (identityProvider == null || identityProvider.getProvisioningConnectorConfigs() == null) { return; } for (ProvisioningConnectorConfig provisioningConnectorConfig : identityProvider .getProvisioningConnectorConfigs()) { Property[] properties = provisioningConnectorConfig.getProvisioningProperties(); if (ArrayUtils.isEmpty(properties)) { continue; } properties = RandomPasswordProcessor.getInstance().removeRandomPasswords(properties, withCacheClear); provisioningConnectorConfig.setProvisioningProperties(properties); } }
Example #24
Source File: IdentityApplicationManagementUtil.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
/** * This is used in back end. Property is the type of stub generated property * * @param authnConfigs authenticatorConfigs to iterate * @param authenticatorName authenticator name of which the values are needed * @param propNameStartsWith the prefix of the property name * @return the list of values which statrts with the propNameStartsWith. */ public static List<String> getPropertyValuesForNameStartsWith(FederatedAuthenticatorConfig[] authnConfigs, String authenticatorName, String propNameStartsWith) { List<String> propValueSet = new ArrayList<>(); for (FederatedAuthenticatorConfig config : authnConfigs) { if (authenticatorName.equals(config.getName())) { for (Property prop : config.getProperties()) { if (prop.getName().startsWith(propNameStartsWith)) { propValueSet.add(prop.getValue()); } } } } return propValueSet; }
Example #25
Source File: SalesforceProvisioningConnector.java From carbon-identity with Apache License 2.0 | 6 votes |
@Override /** * */ public void init(Property[] provisioningProperties) throws IdentityProvisioningException { Properties configs = new Properties(); if (provisioningProperties != null && provisioningProperties.length > 0) { for (Property property : provisioningProperties) { configs.put(property.getName(), property.getValue()); if (IdentityProvisioningConstants.JIT_PROVISIONING_ENABLED.equals(property .getName()) && "1".equals(property.getValue())) { jitProvisioningEnabled = true; } } } configHolder = new SalesforceProvisioningConnectorConfig(configs); }
Example #26
Source File: GoogleProvisioningConnectorFactory.java From carbon-identity with Apache License 2.0 | 5 votes |
@Override protected AbstractOutboundProvisioningConnector buildConnector( Property[] provisioningProperties) throws IdentityProvisioningException { GoogleProvisioningConnector googleConnector = new GoogleProvisioningConnector(); googleConnector.init(provisioningProperties); if (log.isDebugEnabled()) { log.debug("Google provisioning connector created successfully."); } return googleConnector; }
Example #27
Source File: IdentityProviderManager.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
private boolean validateIdPEntityId(FederatedAuthenticatorConfig[] federatedAuthenticatorConfigs, int tenantId, String tenantDomain) throws IdentityProviderManagementException { if (federatedAuthenticatorConfigs != null) { for (FederatedAuthenticatorConfig authConfig : federatedAuthenticatorConfigs) { if (IdentityApplicationConstants.Authenticator.SAML2SSO.FED_AUTH_NAME.equals(authConfig.getName()) || IdentityApplicationConstants.Authenticator.SAML2SSO.NAME.equals(authConfig.getName())) { Property[] properties = authConfig.getProperties(); if (properties != null) { for (Property property : properties) { if (IdentityApplicationConstants.Authenticator.SAML2SSO.IDP_ENTITY_ID.equals( property.getName())) { if (dao.isIdPAvailableForAuthenticatorProperty(authConfig.getName(), IdentityApplicationConstants.Authenticator.SAML2SSO.IDP_ENTITY_ID, property.getValue(), tenantId)) { String msg = "An Identity Provider Entity ID has already been registered with the " + "name '" + property.getValue() + "' for tenant '" + tenantDomain + "'"; throw new IdentityProviderManagementException(msg); } return true; } } } } } } return true; }
Example #28
Source File: IdentityApplicationManagementUtil.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
/** * @param o1 * @param o2 * @return */ public static Property[] concatArrays(Property[] o1, Property[] o2) { Set<Property> properties = new HashSet<>(Arrays.asList(removeEmptyElements(o1))); properties.addAll(Arrays.asList(removeEmptyElements(o2))); return properties.toArray(new Property[properties.size()]); }
Example #29
Source File: OAuthApplicationMgtListener.java From carbon-identity with Apache License 2.0 | 5 votes |
private void addClientSecret(ServiceProvider serviceProvider) throws IdentityApplicationManagementException { if (serviceProvider == null) { return ; // if service provider is not present no need to add this information } try { InboundAuthenticationConfig inboundAuthenticationConfig = serviceProvider.getInboundAuthenticationConfig(); if (inboundAuthenticationConfig != null) { InboundAuthenticationRequestConfig[] inboundRequestConfigs = inboundAuthenticationConfig. getInboundAuthenticationRequestConfigs(); if (inboundRequestConfigs != null) { for (InboundAuthenticationRequestConfig inboundRequestConfig : inboundRequestConfigs) { if (inboundRequestConfig.getInboundAuthType().equals(OAUTH2)) { Property[] props = inboundRequestConfig.getProperties(); Property property = new Property(); property.setName(OAUTH2_CONSUMER_SECRET); property.setValue(getClientSecret(inboundRequestConfig.getInboundAuthKey())); props = (Property[]) ArrayUtils.add(props, property); inboundRequestConfig.setProperties(props); continue;// we are interested only on oauth2 config. Only one will be present. } else { //ignore } } } else { //ignore } } else { //nothing to do } } catch (IdentityOAuthAdminException e) { throw new IdentityApplicationManagementException("Injecting client secret failed.", e); } return; }
Example #30
Source File: ApplicationMgtUtil.java From carbon-identity with Apache License 2.0 | 5 votes |
/** * Get Property values * * @param tenantDomain Tenant domain * @param spIssuer SP Issuer * @param propertyNames Property names * @return Properties map * @throws IdentityApplicationManagementException */ protected Map<String, String> getPropertyValues(String tenantDomain, String spIssuer, List<String> propertyNames) throws IdentityApplicationManagementException { ServiceProvider serviceProvider = ApplicationMgtSystemConfig.getInstance().getApplicationDAO() .getApplication(spIssuer, tenantDomain); if (serviceProvider == null) { throw new IdentityApplicationManagementException( "No service provider exists in the provided tenant, with the given issuer id " + spIssuer); } Map<String, String> propKeyValueMap = new HashMap<String, String>(); InboundAuthenticationRequestConfig[] inboundAuthReqConfigs = serviceProvider.getInboundAuthenticationConfig() .getInboundAuthenticationRequestConfigs(); if (inboundAuthReqConfigs != null && inboundAuthReqConfigs.length > 0) { for (InboundAuthenticationRequestConfig authConfig : inboundAuthReqConfigs) { Property[] properties = authConfig.getProperties(); for (Property prop : properties) { if (propertyNames.contains(prop.getName())) { propKeyValueMap.put(prop.getName(), prop.getValue()); } } } } return propKeyValueMap; }