wso2 / charon

121 stars 164 forks source link

Add implementation to build user schema extension with `InputStream` #401

Closed senthuran16 closed 7 months ago

senthuran16 commented 7 months ago

Purpose

Currently, we only have the following method, where configFilePath is the path of SCIM2 Schema Extension config file (eg: scim2-schema-extension.config).

SCIMUserSchemaExtensionBuilder.getInstance().buildUserSchemaExtension(configFilePath)

In IS7 Connector [1], we pack this SCIM2 Schema Extension config file as a resource. For a resource file, we can get an InputStream, and it won't be possible to treat it as a file and get a file path. Therefore, we need to be able to build user schema extension with this InputStream as:

InputStream schemaExtensionConfigInputStream = ClaimMappingReader.class.getClassLoader()
                    .getResourceAsStream(SCIM2_SCHEMA_EXTENSION_CONFIG_FILE);
SCIMUserSchemaExtensionBuilder.getInstance().buildUserSchemaExtension(schemaExtensionConfigInputStream);

This PR introduces the buildUserSchemaExtension(InputStream inputStream) method. Fixes https://github.com/wso2/api-manager/issues/2693

[1] https://github.com/wso2-extensions/apim-km-wso2is/pull/135