diff --git a/components/org.wso2.carbon.identity.webfinger/pom.xml b/components/org.wso2.carbon.identity.webfinger/pom.xml
index 4b824ff0f88..51dba253f3c 100644
--- a/components/org.wso2.carbon.identity.webfinger/pom.xml
+++ b/components/org.wso2.carbon.identity.webfinger/pom.xml
@@ -55,6 +55,7 @@
org.wso2.carbon.identity.framework
org.wso2.carbon.identity.testutil
+ test
@@ -83,11 +84,6 @@
mockito-core
test
-
- org.wso2.carbon.identity.framework
- org.wso2.carbon.identity.testutil
- test
-
org.mockito
mockito-testng
diff --git a/components/org.wso2.carbon.identity.webfinger/src/test/java/org/wso2/carbon/identity/webfinger/builders/WebFingerOIDCResponseBuilderTest.java b/components/org.wso2.carbon.identity.webfinger/src/test/java/org/wso2/carbon/identity/webfinger/builders/WebFingerOIDCResponseBuilderTest.java
index cb3d2ebd7a5..c5c763bc452 100644
--- a/components/org.wso2.carbon.identity.webfinger/src/test/java/org/wso2/carbon/identity/webfinger/builders/WebFingerOIDCResponseBuilderTest.java
+++ b/components/org.wso2.carbon.identity.webfinger/src/test/java/org/wso2/carbon/identity/webfinger/builders/WebFingerOIDCResponseBuilderTest.java
@@ -23,11 +23,17 @@
import org.testng.annotations.Test;
import org.wso2.carbon.base.ServerConfigurationException;
import org.wso2.carbon.identity.base.IdentityException;
+import org.wso2.carbon.identity.common.testng.WithCarbonHome;
+import org.wso2.carbon.identity.core.util.IdentityConfigParser;
import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception;
import org.wso2.carbon.identity.oauth2.util.OAuth2Util;
import org.wso2.carbon.identity.webfinger.WebFingerEndpointException;
import org.wso2.carbon.identity.webfinger.WebFingerRequest;
import org.wso2.carbon.identity.webfinger.WebFingerResponse;
+import org.wso2.carbon.utils.CarbonUtils;
+
+import java.io.File;
+import java.lang.reflect.Field;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mockStatic;
@@ -36,6 +42,7 @@
/**
* Unit test coverage for WebFingerOIDCResponseBuilder class.
*/
+@WithCarbonHome
public class WebFingerOIDCResponseBuilderTest {
private WebFingerOIDCResponseBuilder webFingerOIDCResponseBuilder;
@@ -63,6 +70,9 @@ public void setUp() throws Exception {
webFingerRequest.setRel(rel);
webFingerRequest.setTenant(tenant);
+ setPrivateStaticField(IdentityConfigParser.class, "configFilePath", System.getProperty("carbon.home")
+ + File.separator + "repository" + File.separator + "conf" + File.separator + "identity"
+ + File.separator + "identity.xml");
oAuth2Util = mockStatic(OAuth2Util.class);
}
@@ -72,6 +82,14 @@ public void tearDown() {
oAuth2Util.close();
}
+ private void setPrivateStaticField(Class> clazz, String fieldName, Object newValue)
+ throws NoSuchFieldException, IllegalAccessException {
+
+ Field field = clazz.getDeclaredField(fieldName);
+ field.setAccessible(true);
+ field.set(null, newValue);
+ }
+
@Test
public void testBuildWebFingerResponse() throws Exception {
diff --git a/components/org.wso2.carbon.identity.webfinger/src/test/resources/repository/conf/identity/identity.xml b/components/org.wso2.carbon.identity.webfinger/src/test/resources/repository/conf/identity/identity.xml
deleted file mode 100644
index 4f56c693a4e..00000000000
--- a/components/org.wso2.carbon.identity.webfinger/src/test/resources/repository/conf/identity/identity.xml
+++ /dev/null
@@ -1,527 +0,0 @@
-
-
-
-
-
-
-
-
- jdbc/WSO2IdentityDB
-
-
-
-
- true
- true
- 0
-
- true
- 20160
- 1140
-
-
- true
- 720
-
-
-
-
-
-
- 15
- 20160
-
-
-
-
-
- ${carbon.home}/conf/keystores
- SunX509
- SunX509
-
-
-
- SelfAndManaged
- CertValidate
-
-
-
-
-
-
-
-
-
-
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/openidserver
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/openid
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/authenticationendpoint/openid_login.do
-
-
- false
-
- 7200
-
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/oauth/request-token
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/oauth/authorize-url
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/oauth/access-token
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/oauth2/authorize
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/oauth2/par
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/oauth2/token
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/oauth2/revoke
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/oauth2/introspect
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/oauth2/userinfo
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/oidc/checksession
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/oidc/logout
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/authenticationendpoint/oauth2_authz.do
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/authenticationendpoint/oauth2_error.do
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/authenticationendpoint/oauth2_consent.do
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/authenticationendpoint/oauth2_logout_consent.do
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/authenticationendpoint/oauth2_logout.do
-
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/.well-known/webfinger
-
-
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/identity/connect/register
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/oauth2/jwks
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/oauth2/oidcdiscovery
-
-
- 300
-
- 3600
-
- 3600
-
- 84600
-
- 300
-
- false
-
- true
-
- org.wso2.carbon.identity.oauth.tokenprocessor.PlainTextPersistenceProcessor
-
-
-
- false
-
-
-
-
-
- token
- org.wso2.carbon.identity.oauth2.authz.handlers.TokenResponseTypeHandler
-
-
- code
- org.wso2.carbon.identity.oauth2.authz.handlers.CodeResponseTypeHandler
-
-
- id_token
- org.wso2.carbon.identity.oauth2.authz.handlers.TokenResponseTypeHandler
-
-
- id_token token
- org.wso2.carbon.identity.oauth2.authz.handlers.TokenResponseTypeHandler
-
-
-
-
-
- authorization_code
- org.wso2.carbon.identity.oauth2.token.handlers.grant.AuthorizationCodeGrantHandler
-
-
- password
- org.wso2.carbon.identity.oauth2.token.handlers.grant.PasswordGrantHandler
-
-
- refresh_token
- org.wso2.carbon.identity.oauth2.token.handlers.grant.RefreshGrantHandler
-
-
- client_credentials
- org.wso2.carbon.identity.oauth2.token.handlers.grant.ClientCredentialsGrantHandler
-
-
- urn:ietf:params:oauth:grant-type:saml2-bearer
- org.wso2.carbon.identity.oauth2.token.handlers.grant.saml.SAML2BearerGrantHandler
-
-
- iwa:ntlm
- org.wso2.carbon.identity.oauth2.token.handlers.grant.iwa.ntlm.NTLMAuthenticationGrantHandler
-
-
-
-
-
-
-
-
- false
-
-
-
- false
-
-
-
- false
- org.wso2.carbon.identity.oauth2.authcontext.JWTTokenGenerator
- org.wso2.carbon.identity.oauth2.authcontext.DefaultClaimsRetriever
- http://wso2.org/claims
- SHA256withRSA
- 15
-
-
-
-
-
- org.wso2.carbon.identity.openidconnect.DefaultIDTokenBuilder
- SHA256withRSA
-
-
-
-
-
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/oauth2/token
- org.wso2.carbon.identity.openidconnect.SAMLAssertionClaimsCallback
- 3600
- org.wso2.carbon.identity.oauth.endpoint.user.impl.UserInfoUserStoreClaimRetriever
- org.wso2.carbon.identity.oauth.endpoint.user.impl.UserInforRequestDefaultValidator
- org.wso2.carbon.identity.oauth.endpoint.user.impl.UserInfoISAccessTokenValidator
- org.wso2.carbon.identity.oauth.endpoint.user.impl.UserInfoJSONResponseBuilder
- false
-
-
- 6
- 600000
- 5000
- BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz23456789
-
-
- true
- true
-
-
-
-
-
-
- gtalk
- talk.google.com
- 5222
- gmail.com
- multifactor1@gmail.com
- wso2carbon
-
-
-
-
-
- ${carbon.host}
-
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/samlsso
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/authenticationendpoint/samlsso_logout.do
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/authenticationendpoint/samlsso_notification.do
- 5
- 60000
-
- false
- http://wso2.org/claims
-
- org.wso2.carbon.identity.sso.saml.builders.assertion.DefaultSAMLAssertionBuilder
- org.wso2.carbon.identity.sso.saml.builders.encryption.DefaultSSOEncrypter
- org.wso2.carbon.identity.sso.saml.builders.signature.DefaultSSOSigner
- org.wso2.carbon.identity.sso.saml.validators.SAML2HTTPRedirectDeflateSignatureValidator
-
-
-
- 5
- false
- http://www.w3.org/2000/09/xmldsig#rsa-sha1
- http://www.w3.org/2000/09/xmldsig#sha1
- true
-
-
-
-
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/services/wso2carbon-sts
-
-
-
-
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/passivests
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/authenticationendpoint/retry.do
- org.wso2.carbon.identity.sts.passive.utils.NoPersistenceTokenStore
- true
-
-
-
-
- false
- ${Ports.ThriftEntitlementReceivePort}
- 10000
-
- ${carbon.home}/repository/resources/security/wso2carbon.jks
- wso2carbon
-
-
- ${carbon.host}
-
-
-
-
-
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/wso2/scim/Users
- ${carbon.protocol}://${carbon.host}:${carbon.management.port}/wso2/scim/Groups
-
-
- 5
-
-
- 10
- local://services
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.wso2.carbon.identity.governance.store.JDBCIdentityDataStore
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /permission/admin/manage/identity/applicationmgt/delete
-
-
- /permission/admin/manage/identity/applicationmgt/create
-
-
- /permission/admin/manage/identity/applicationmgt/view
-
-
- /permission/admin/manage/identity/pep
-
-
-
-
-
-
-
-
-
- /api/identity/user/v0.9
- /api/identity/recovery/v0.9
- /oauth2
- /api/identity/entitlement
-
-
- /identity/(.*)
-
-
-
-
- 300
-