Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable ANA Basic #19316

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -110,6 +115,7 @@ public class ApplicationNativeAuthenticationTestCase extends OAuth2ServiceAbstra
private CloseableHttpClient client;
private UserManagementClient userMgtServiceClient;
private String code;
private static final String basicAuthenticatorId = "QmFzaWNBdXRoZW50aWNhdG9yOkxPQ0FM";

@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
Expand Down Expand Up @@ -274,6 +280,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 Expand Up @@ -325,6 +347,8 @@ private void validInitClientNativeAuthnResponse(JSONObject json) {
authenticator.containsKey(REQUIRED_PARAMS)) {

authenticatorId = (String) authenticator.get(AUTHENTICATOR_ID);
Assert.assertEquals(authenticatorId, basicAuthenticatorId, "Authenticator Id is not " +
"equal for basic authenticator ID");
JSONObject metadataNode = (JSONObject) authenticator.get(METADATA);
if (metadataNode.containsKey(PROMPT_TYPE) && metadataNode.containsKey(PARAMS)) {
paramsArray = (JSONArray) metadataNode.get(PARAMS);
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 @@ -133,8 +133,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"/>
<!-- Temporarily commenting out following test case cause due to intermittent error-->
<!-- <class name="org.wso2.identity.integration.test.applicationNativeAuthentication.ApplicationNativeAuthenticationTestCase"/>-->
<class name="org.wso2.identity.integration.test.applicationNativeAuthentication.ApplicationNativeAuthenticationTestCase"/>
</classes>
</test>

Expand Down