Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
794 views
in Technique[技术] by (71.8m points)

java - After ignore SSL certificate via Rest Assured get 401 for token request

After that I have found fix for this Exaptation,

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

fixed this Exaptation with code below:

request.config(RestAssured.config().sslConfig(new SSLConfig().allowAllHostnames().relaxedHTTPSValidation()));

I faced a problem can't to get token from response. I get 401 status code for authorization request, /token/missed. Have not idea why. 'cuz via Postman I should not set token in header for this request, request to get token. Probably somebody had faced this issue and know how to fix it?

   public EndPoints (String baseUrl) {
    RestAssured.baseURI = baseUrl;
    request = RestAssured.given();
    request.config(RestAssured.config().sslConfig(new SSLConfig().allowAllHostnames().relaxedHTTPSValidation()));
    request.header("Content-Type", "application/json");
    request.header("Accept","application/json");

}

public void authenticateUser(AuthorizationRequest authorizationRequest) {
    Response response = request.log().all().body(authorizationRequest).post(RoutApi.loginTo());             
question from:https://stackoverflow.com/questions/65680081/after-ignore-ssl-certificate-via-rest-assured-get-401-for-token-request

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...