-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jans-auth-server): ssa validation endpoint (#2842)
- Loading branch information
Showing
26 changed files
with
750 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
jans-auth-server/client/src/main/java/io/jans/as/client/ssa/validate/SsaValidateClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. | ||
* | ||
* Copyright (c) 2020, Janssen Project | ||
*/ | ||
|
||
package io.jans.as.client.ssa.validate; | ||
|
||
import io.jans.as.client.BaseClient; | ||
import jakarta.ws.rs.HttpMethod; | ||
import jakarta.ws.rs.client.Invocation.Builder; | ||
import org.apache.log4j.Logger; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class SsaValidateClient extends BaseClient<SsaValidateRequest, SsaValidateResponse> { | ||
|
||
private static final Logger LOG = Logger.getLogger(SsaValidateClient.class); | ||
|
||
public SsaValidateClient(String url) { | ||
super(url); | ||
} | ||
|
||
@Override | ||
public String getHttpMethod() { | ||
return HttpMethod.GET; | ||
} | ||
|
||
public SsaValidateResponse execSsaValidate(@NotNull String jti) { | ||
SsaValidateRequest ssaGetRequest = new SsaValidateRequest(); | ||
ssaGetRequest.setJti(jti); | ||
setRequest(ssaGetRequest); | ||
return exec(); | ||
} | ||
|
||
public SsaValidateResponse exec() { | ||
try { | ||
initClient(); | ||
|
||
Builder clientRequest = webTarget.request(); | ||
applyCookies(clientRequest); | ||
|
||
clientRequest.header("Content-Type", request.getContentType()); | ||
clientRequest.header("jti", request.getJti()); | ||
|
||
clientResponse = clientRequest.build(HttpMethod.HEAD).invoke(); | ||
final SsaValidateResponse res = new SsaValidateResponse(clientResponse); | ||
setResponse(res); | ||
|
||
} catch (Exception e) { | ||
LOG.error(e.getMessage(), e); | ||
} finally { | ||
closeConnection(); | ||
} | ||
|
||
return getResponse(); | ||
} | ||
} | ||
|
35 changes: 35 additions & 0 deletions
35
jans-auth-server/client/src/main/java/io/jans/as/client/ssa/validate/SsaValidateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. | ||
* | ||
* Copyright (c) 2020, Janssen Project | ||
*/ | ||
|
||
package io.jans.as.client.ssa.validate; | ||
|
||
import io.jans.as.client.BaseRequest; | ||
import io.jans.as.model.common.AuthorizationMethod; | ||
import jakarta.ws.rs.core.MediaType; | ||
|
||
public class SsaValidateRequest extends BaseRequest { | ||
|
||
private String jti; | ||
|
||
public SsaValidateRequest() { | ||
setContentType(MediaType.APPLICATION_JSON); | ||
setMediaType(MediaType.APPLICATION_JSON); | ||
setAuthorizationMethod(AuthorizationMethod.AUTHORIZATION_REQUEST_HEADER_FIELD); | ||
} | ||
|
||
public String getJti() { | ||
return jti; | ||
} | ||
|
||
public void setJti(String jti) { | ||
this.jti = jti; | ||
} | ||
|
||
@Override | ||
public String getQueryString() { | ||
return null; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...-auth-server/client/src/main/java/io/jans/as/client/ssa/validate/SsaValidateResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. | ||
* | ||
* Copyright (c) 2020, Janssen Project | ||
*/ | ||
|
||
package io.jans.as.client.ssa.validate; | ||
|
||
import io.jans.as.client.BaseResponseWithErrors; | ||
import io.jans.as.model.ssa.SsaErrorResponseType; | ||
import jakarta.ws.rs.core.Response; | ||
|
||
public class SsaValidateResponse extends BaseResponseWithErrors<SsaErrorResponseType> { | ||
|
||
public SsaValidateResponse(Response clientResponse) { | ||
super(clientResponse); | ||
} | ||
|
||
@Override | ||
public SsaErrorResponseType fromString(String p_str) { | ||
return SsaErrorResponseType.fromString(p_str); | ||
} | ||
|
||
@Override | ||
public void injectDataFromJson(String json) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.