Search in sources :

Example 1 with AuthenticationContext

use of org.wso2.carbon.apimgt.gateway.handlers.security.AuthenticationContext in project identity-outbound-auth-sms-otp by wso2-extensions.

the class SMSOTPUtilsTest method testGetDigitsOrderFromRegistry.

@Test
public void testGetDigitsOrderFromRegistry() throws AuthenticationFailedException {
    AuthenticationContext authenticationContext = new AuthenticationContext();
    authenticationContext.setTenantDomain("wso2.org");
    authenticationContext.setProperty(SMSOTPConstants.ORDER, "backward");
    Assert.assertEquals(SMSOTPUtils.getDigitsOrder(authenticationContext, SMSOTPConstants.AUTHENTICATOR_NAME), "backward");
}
Also used : AuthenticationContext(org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 2 with AuthenticationContext

use of org.wso2.carbon.apimgt.gateway.handlers.security.AuthenticationContext in project identity-outbound-auth-sms-otp by wso2-extensions.

the class SMSOTPUtilsTest method testGetScreenUserAttributeFromRegistry.

@Test
public void testGetScreenUserAttributeFromRegistry() throws AuthenticationFailedException {
    AuthenticationContext authenticationContext = new AuthenticationContext();
    authenticationContext.setTenantDomain("wso2.org");
    authenticationContext.setProperty(SMSOTPConstants.SCREEN_USER_ATTRIBUTE, "http://wso2.org/claims/mobile");
    Assert.assertEquals(SMSOTPUtils.getScreenUserAttribute(authenticationContext, SMSOTPConstants.AUTHENTICATOR_NAME), "http://wso2.org/claims/mobile");
}
Also used : AuthenticationContext(org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 3 with AuthenticationContext

use of org.wso2.carbon.apimgt.gateway.handlers.security.AuthenticationContext in project identity-outbound-auth-sms-otp by wso2-extensions.

the class SMSOTPUtilsTest method testGetErrorPageFromXMLFileFromRegistry.

@Test
public void testGetErrorPageFromXMLFileFromRegistry() throws AuthenticationFailedException {
    AuthenticationContext authenticationContext = new AuthenticationContext();
    authenticationContext.setTenantDomain("wso2.org");
    authenticationContext.setProperty(SMSOTPConstants.SMSOTP_AUTHENTICATION_ERROR_PAGE_URL, SMSOTPConstants.ERROR_PAGE);
    Assert.assertEquals(SMSOTPUtils.getErrorPageFromXMLFile(authenticationContext, SMSOTPConstants.AUTHENTICATOR_NAME), "smsotpauthenticationendpoint/smsotpError.jsp");
}
Also used : AuthenticationContext(org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 4 with AuthenticationContext

use of org.wso2.carbon.apimgt.gateway.handlers.security.AuthenticationContext in project identity-outbound-auth-sms-otp by wso2-extensions.

the class SMSOTPUtilsTest method testGetMobileNumberRequestPageFromRegistry.

@Test
public void testGetMobileNumberRequestPageFromRegistry() throws AuthenticationFailedException {
    AuthenticationContext authenticationContext = new AuthenticationContext();
    authenticationContext.setTenantDomain("wso2.org");
    authenticationContext.setProperty(SMSOTPConstants.MOBILE_NUMBER_REQ_PAGE, "smsotpauthenticationendpoint/mobile.jsp");
    Assert.assertEquals(SMSOTPUtils.getMobileNumberRequestPage(authenticationContext, SMSOTPConstants.AUTHENTICATOR_NAME), "smsotpauthenticationendpoint/mobile.jsp");
}
Also used : AuthenticationContext(org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 5 with AuthenticationContext

use of org.wso2.carbon.apimgt.gateway.handlers.security.AuthenticationContext in project identity-outbound-auth-sms-otp by wso2-extensions.

the class SMSOTPUtilsTest method testIsSMSOTPMandatoryFromRegistry.

@Test
public void testIsSMSOTPMandatoryFromRegistry() throws AuthenticationFailedException {
    AuthenticationContext authenticationContext = new AuthenticationContext();
    authenticationContext.setTenantDomain("wso2.org");
    authenticationContext.setProperty(SMSOTPConstants.IS_SMSOTP_MANDATORY, "true");
    Assert.assertEquals(SMSOTPUtils.isSMSOTPMandatory(authenticationContext, SMSOTPConstants.AUTHENTICATOR_NAME), true);
}
Also used : AuthenticationContext(org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

AuthenticationContext (org.wso2.carbon.apimgt.gateway.handlers.security.AuthenticationContext)96 Axis2MessageContext (org.apache.synapse.core.axis2.Axis2MessageContext)69 Test (org.junit.Test)69 MessageContext (org.apache.synapse.MessageContext)56 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)49 ArrayList (java.util.ArrayList)31 ConditionGroupDTO (org.wso2.carbon.apimgt.api.dto.ConditionGroupDTO)31 TreeMap (java.util.TreeMap)22 VerbInfoDTO (org.wso2.carbon.apimgt.impl.dto.VerbInfoDTO)22 API (org.wso2.carbon.apimgt.keymgt.model.entity.API)21 HashMap (java.util.HashMap)19 Cache (javax.cache.Cache)18 Test (org.testng.annotations.Test)18 AuthenticationContext (org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext)18 ThrottleProperties (org.wso2.carbon.apimgt.impl.dto.ThrottleProperties)17 SignedJWT (com.nimbusds.jwt.SignedJWT)16 ConditionDTO (org.wso2.carbon.apimgt.api.dto.ConditionDTO)16 ThrottleDataHolder (org.wso2.carbon.apimgt.gateway.throttling.ThrottleDataHolder)16 APISecurityException (org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException)15 APIKeyValidationInfoDTO (org.wso2.carbon.apimgt.impl.dto.APIKeyValidationInfoDTO)14