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

fix: update test cases #8364

Merged
merged 1 commit into from
Apr 22, 2024
Merged
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 @@ -3,4 +3,3 @@ server=https://jgomer2001-guiding-herring.gluu.info

clientId=BADA-BADA

custParamName=agama_flow
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;

import io.jans.as.model.util.Base64Util;
import io.jans.inbound.oauth2.CodeGrantUtil;
import io.jans.inbound.oauth2.OAuthParams;

Expand Down Expand Up @@ -37,7 +38,7 @@

public class BaseTest {

private static String AGAMA_ACR = "agama";
private static String ACR_PREFIX = "agama_";
private static Map<String, String> MAP = null;

Logger logger = LogManager.getLogger(getClass());
Expand All @@ -63,7 +64,7 @@ public void init(ITestContext context) throws IOException {
String propertiesFile = context.getCurrentXmlTest().getParameter("propertiesFile");
Properties prop = new Properties();
prop.load(Files.newBufferedReader(Paths.get(propertiesFile), UTF_8));

MAP = new Hashtable<>();
//do not bother about empty keys... but
//If a value is found null, this will throw a NPE since we are using a Hashtable
Expand All @@ -79,19 +80,17 @@ String authzRequestUrl(String flowQName, Map<String, Object> inputs) {
p.setClientId(MAP.get("clientId"));
p.setRedirectUri(MAP.get("redirectUri"));
p.setScopes(Collections.singletonList("openid"));

String queryParam = URLEncoder.encode(MAP.get("custParamName"), UTF_8);

StringBuilder builder = new StringBuilder(flowQName);
StringBuilder builder = new StringBuilder(ACR_PREFIX);
builder.append(flowQName);

if (inputs != null) {
JSONObject jo = new JSONObject(inputs);
builder.append("-").append(jo.toString());
byte[] bytes = jo.toString().getBytes(UTF_8);
builder.append("-").append(Base64Util.base64urlencode(bytes));
}

Map<String, String> custParams = new HashMap<>();
custParams.put("acr_values", AGAMA_ACR);
custParams.put(queryParam, builder.toString());
p.setCustParamsAuthReq(custParams);
p.setCustParamsAuthReq(Map.of("acr_values", builder.toString()));

String url = null;
CodeGrantUtil grant = new CodeGrantUtil(p);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ redirectUri=${server}/.well-known/openid-configuration

clientId=${clientId}

custParamName=${custParamName}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
server=https://%(hostname)s

clientId=BADA-BADA

custParamName=agama_flow