Skip to content

Commit

Permalink
add basic authenticator
Browse files Browse the repository at this point in the history
  • Loading branch information
Thumimku committed Feb 1, 2024
1 parent 488ad97 commit 9c68675
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.ApplicationModel;
import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.ApplicationPatchModel;
import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.ApplicationResponseModel;
import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.AuthenticationSequence;
import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.AuthenticationStep;
import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.Authenticator;
import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.InboundProtocols;
import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.OpenIDConnectConfiguration;
import org.wso2.identity.integration.test.utils.OAuth2Constant;
Expand All @@ -66,6 +69,7 @@
import static org.wso2.identity.integration.test.applicationNativeAuthentication.Constants.AUTHENTICATOR_ID;
import static org.wso2.identity.integration.test.applicationNativeAuthentication.Constants.AUTH_DATA_CODE;
import static org.wso2.identity.integration.test.applicationNativeAuthentication.Constants.AUTH_DATA_SESSION_STATE;
import static org.wso2.identity.integration.test.applicationNativeAuthentication.Constants.BASIC_AUTHENTICATOR;
import static org.wso2.identity.integration.test.applicationNativeAuthentication.Constants.CODE;
import static org.wso2.identity.integration.test.applicationNativeAuthentication.Constants.CONTENT_TYPE_APPLICATION_JSON;
import static org.wso2.identity.integration.test.applicationNativeAuthentication.Constants.ERROR_CODE_CLIENT_NATIVE_AUTHENTICATION_DISABLED;
Expand All @@ -75,6 +79,7 @@
import static org.wso2.identity.integration.test.applicationNativeAuthentication.Constants.HREF;
import static org.wso2.identity.integration.test.applicationNativeAuthentication.Constants.IDP;
import static org.wso2.identity.integration.test.applicationNativeAuthentication.Constants.LINKS;
import static org.wso2.identity.integration.test.applicationNativeAuthentication.Constants.LOCAL;
import static org.wso2.identity.integration.test.applicationNativeAuthentication.Constants.METADATA;
import static org.wso2.identity.integration.test.applicationNativeAuthentication.Constants.NEXT_STEP;
import static org.wso2.identity.integration.test.applicationNativeAuthentication.Constants.PARAMS;
Expand Down Expand Up @@ -274,6 +279,22 @@ private ApplicationResponseModel createAppWithoutClientNativeAuthentication() th
application.setInboundProtocolConfiguration(inboundProtocolsConfig);
application.setName(TEST_APP_NAME);

// Set Basic authenticator as 1st step.
List<Authenticator> authenticators = new ArrayList<>();
List<AuthenticationStep> authenticationSteps = new ArrayList<>();
Authenticator basicAuthenticator = new Authenticator()
.idp(LOCAL)
.authenticator(BASIC_AUTHENTICATOR);
authenticators.add(basicAuthenticator);
AuthenticationSequence authenticationSequence = new AuthenticationSequence();
authenticationSequence.setType(AuthenticationSequence.TypeEnum.USER_DEFINED);
AuthenticationStep authenticationStep = new AuthenticationStep();
authenticationStep.setId(1);
authenticationStep.setOptions(authenticators);
authenticationSteps.add(authenticationStep);
authenticationSequence.setSteps(authenticationSteps);
application.setAuthenticationSequence(authenticationSequence);

String appId = addApplication(application);
return getApplication(appId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public class Constants {
public static final String TEST_USER_NAME = "attestationTestUser";
public static final String TEST_APP_NAME = "oauthTestANAApplication";

// Basic Authenticator
public static final String LOCAL = "LOCAL";
public static final String BASIC_AUTHENTICATOR = "BasicAuthenticator";

public static final String TEST_PASSWORD = "passWord1@";
public static final String TEST_PROFILE = "default";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

<test name="is-tests-default-configuration" preserve-order="true" parallel="false" group-by-instances="true">
<classes>
<class name="org.wso2.identity.integration.test.applicationNativeAuthentication.ApplicationNativeAuthenticationTestCase"/>
<class name="org.wso2.identity.integration.test.oauth2.OAuth2DeviceFlowTestCase"/>
<class name="org.wso2.identity.integration.test.oauth2.OAuth2PushedAuthRequestTestCase"/>
<class name="org.wso2.identity.integration.test.oauth2.OAuth2ResponseModeTestCase"/>
Expand Down Expand Up @@ -137,6 +136,7 @@
<class name="org.wso2.identity.integration.test.identityServlet.ExtendSessionEndpointAuthCodeGrantTestCase"/>
<class name="org.wso2.identity.integration.test.oauth2.OAuth2TokenRevocationWithSessionTerminationTestCase"/>
<class name="org.wso2.identity.integration.test.oauth2.OAuth2TokenRevocationWithMultipleSessionTerminationTestCase"/>
<class name="org.wso2.identity.integration.test.applicationNativeAuthentication.ApplicationNativeAuthenticationTestCase"/>
</classes>
</test>

Expand Down

0 comments on commit 9c68675

Please sign in to comment.