Skip to content

Commit

Permalink
keep original casing for enums
Browse files Browse the repository at this point in the history
* updated openid-configuration.yaml spec with some configuration
  • Loading branch information
jhannes committed Aug 22, 2024
1 parent 0dd5fd4 commit 7e9b8c9
Show file tree
Hide file tree
Showing 18 changed files with 137 additions and 74 deletions.
33 changes: 24 additions & 9 deletions snapshotTests/input/openid-configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ paths:
get:
tags: [ Discovery ]
operationId: getDiscoveryDocument
externalDocs:
url: https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig
responses:
200:
description: The openid discovery document
Expand All @@ -26,6 +28,8 @@ paths:
get:
tags: [ Discovery ]
operationId: getJwksDocument
externalDocs:
url: https://datatracker.ietf.org/doc/html/rfc7517
responses:
200:
description: The cryptographic key description document
Expand Down Expand Up @@ -180,15 +184,17 @@ paths:
properties:
grant_type:
$ref: "#/components/schemas/GrantType"
code:
type: string
client_id:
type: string
client_secret:
type: string
redirect_uri:
type: string
format: uri
code:
type: string
refresh_token:
type: string
subject_token:
type: string
description:
Expand Down Expand Up @@ -241,12 +247,15 @@ paths:
components:
schemas:
ResponseType:
enum:
- code
- token
- id_token
- code id_token
- id_token token
type: string
anyOf:
- enum:
- code
- token
- id_token
- code id_token
- id_token token
- {}
GrantType:
enum:
- implicit
Expand Down Expand Up @@ -340,6 +349,8 @@ components:
- exp
DiscoveryDocument:
type: object
externalDocs:
url: https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationResponse
properties:
issuer:
type: string
Expand Down Expand Up @@ -419,6 +430,8 @@ components:
- issuer
JwksDocument:
type: object
externalDocs:
url: https://datatracker.ietf.org/doc/html/rfc7517
properties:
keys:
type: array
Expand All @@ -428,13 +441,15 @@ components:
- keys
JwksKey:
type: object
externalDocs:
url: https://datatracker.ietf.org/doc/html/rfc7517#section-4
properties:
kty:
type: string
example: RSA
use:
type: string
example: sig
example: sig, enc
kid:
type: string
x5c:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
@Getter
@RequiredArgsConstructor
public enum PetTypeDto {
CAT("cat"),
DOG("dog"),
BIRD("bird");
cat("cat"),
dog("dog"),
bird("bird");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ public final class ExposureDto {
@Getter
@RequiredArgsConstructor
public enum StatusEnum {
UNIDENTIFIED("unidentified"),
IDENTIFIED("identified"),
CONTACTED("contacted"),
TESTED("tested"),
INFECTED("infected");
unidentified("unidentified"),
identified("identified"),
contacted("contacted"),
tested("tested"),
infected("infected");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
@Getter
@RequiredArgsConstructor
public enum UserRoleDto {
ADMINISTRATOR("administrator"),
INTERVIEWER("interviewer"),
FOLLOWUP("followup");
administrator("administrator"),
interviewer("interviewer"),
followup("followup");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
public interface DiscoveryApi {
/**
* @return DiscoveryDocumentDto
*
* @see <a href="https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig"> Documentation</a>
*/
DiscoveryDocumentDto getDiscoveryDocument(
) throws IOException;
/**
* @return JwksDocumentDto
*
* @see <a href="https://datatracker.ietf.org/doc/html/rfc7517"> Documentation</a>
*/
JwksDocumentDto getJwksDocument(
) throws IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public interface IdentityProviderApi {
* @param acr_values Requested Authentication Context Class Reference values. Space-separated string that specifies the acr values that the Authorization Server is being requested to use for processing this Authentication Request, with the values appearing in order of preference. The Authentication Context Class satisfied by the authentication performed is returned as the acr Claim Value, as specified in Section 2 (query) (optional
* @param nonce OPTIONAL. String value used to associate a Client session with an ID Token, and to mitigate replay attacks. The value is passed through unmodified from the Authentication Request to the ID Token (query) (optional)
* @param display (query) (optional)
*
*
* @see <a href="https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest"> Documentation</a>
*/
void authorization(
Expand Down Expand Up @@ -99,22 +99,24 @@ public String toUrlEncoded() {
}
/**
* @param grant_type (required)
* @param code (required)
* @param client_id (required)
* @param code (required)
* @param Authorization Used with token-exchange to validate client_name - use Basic authentication with client_id:client_secret (optional)
* @param client_secret (optional)
* @param redirect_uri (optional)
* @param refresh_token (optional)
* @param subject_token Used with grant_type&#x3D;urn:ietf:params:oauth:grant-type:token-exchange to do a token exchange (optional)
* @param audience Used with token-exchange to indicate which application the token will be used with (optional)
* @return TokenResponseDto
*/
TokenResponseDto fetchToken(
GrantTypeDto grant_type,
String code,
String client_id,
String code,
Optional<String> Authorization,
Optional<String> client_secret,
Optional<URI> redirect_uri,
Optional<String> refresh_token,
Optional<String> subject_token,
Optional<String> audience
) throws IOException;
Expand All @@ -127,10 +129,11 @@ class FetchTokenHeaders {
@Data
class FetchTokenForm {
private GrantTypeDto grantType;
private String code;
private String clientId;
private String clientSecret;
private URI redirectUri;
private String code;
private String refreshToken;
private String subjectToken;
private String audience;

Expand All @@ -139,9 +142,6 @@ public String toUrlEncoded() {
if (grantType != null) {
parameters.add("grant_type=" + encode(grantType.toString(), UTF_8));
}
if (code != null) {
parameters.add("code=" + encode(code.toString(), UTF_8));
}
if (clientId != null) {
parameters.add("client_id=" + encode(clientId.toString(), UTF_8));
}
Expand All @@ -151,6 +151,12 @@ public String toUrlEncoded() {
if (redirectUri != null) {
parameters.add("redirect_uri=" + encode(redirectUri.toString(), UTF_8));
}
if (code != null) {
parameters.add("code=" + encode(code.toString(), UTF_8));
}
if (refreshToken != null) {
parameters.add("refresh_token=" + encode(refreshToken.toString(), UTF_8));
}
if (subjectToken != null) {
parameters.add("subject_token=" + encode(subjectToken.toString(), UTF_8));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public final class DiscoveryDocumentDto {
@Getter
@RequiredArgsConstructor
public enum ResponseModesSupportedEnum {
QUERY("query"),
FRAGMENT("fragment"),
FORM_POST("form_post");
query("query"),
fragment("fragment"),
form_post("form_post");

private final String value;

Expand All @@ -28,8 +28,8 @@ public String toString() {
@Getter
@RequiredArgsConstructor
public enum SubjectTypesSupportedEnum {
PAIRWISE("pairwise"),
PUBLIC("public");
pairwise("pairwise"),
_public("public");

private final String value;

Expand All @@ -43,7 +43,7 @@ public String toString() {
@RequiredArgsConstructor
public enum CodeChallengeMethodsSupportedEnum {
S256("S256"),
PLAIN("plain");
plain("plain");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
@Getter
@RequiredArgsConstructor
public enum GrantTypeDto {
IMPLICIT("implicit"),
AUTHORIZATION_CODE("authorization_code"),
CLIENT_CREDENTIALS("client_credentials"),
REFRESH_TOKEN("refresh_token"),
URN_IETF_PARAMS_OAUTH_GRANT_TYPE_TOKEN_EXCHANGE("urn:ietf:params:oauth:grant-type:token-exchange");
implicit("implicit"),
authorization_code("authorization_code"),
client_credentials("client_credentials"),
refresh_token("refresh_token"),
urn_ietf_params_oauth_grant_type_token_exchange("urn:ietf:params:oauth:grant-type:token-exchange");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ public final class OauthErrorDto {
@Getter
@RequiredArgsConstructor
public enum ErrorEnum {
INVALID_REQUEST("invalid_request"),
INVALID_CLIENT("invalid_client"),
INVALID_GRANT("invalid_grant"),
UNAUTHORIZED_CLIENT("unauthorized_client"),
UNSUPPORTED_GRANT_TYPE("unsupported_grant_type"),
INVALID_SCOPE("invalid_scope");
invalid_request("invalid_request"),
invalid_client("invalid_client"),
invalid_grant("invalid_grant"),
unauthorized_client("unauthorized_client"),
unsupported_grant_type("unsupported_grant_type"),
invalid_scope("invalid_scope");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
@Getter
@RequiredArgsConstructor
public enum ResponseTypeDto {
CODE("code"),
TOKEN("token"),
ID_TOKEN("id_token"),
CODE_ID_TOKEN("code id_token"),
ID_TOKEN_TOKEN("id_token token");
code("code"),
token("token"),
id_token("id_token"),
code_id_token("code id_token"),
id_token_token("id_token token");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public final class OrderDto {
@Getter
@RequiredArgsConstructor
public enum StatusEnum {
PLACED("placed"),
APPROVED("approved"),
DELIVERED("delivered");
placed("placed"),
approved("approved"),
delivered("delivered");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public final class PetDto {
@Getter
@RequiredArgsConstructor
public enum StatusEnum {
AVAILABLE("available"),
PENDING("pending"),
SOLD("sold");
available("available"),
pending("pending"),
sold("sold");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public final class PetDto {
@Getter
@RequiredArgsConstructor
public enum PetTypeEnum {
CAT("Cat"),
DOG("Dog");
Cat("Cat"),
Dog("Dog");

private final String value;

Expand All @@ -27,9 +27,9 @@ public String toString() {
@Getter
@RequiredArgsConstructor
public enum StatusEnum {
PENDING("Pending"),
AVAILABLE("Available"),
SOLD("Sold");
Pending("Pending"),
Available("Available"),
Sold("Sold");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ public sealed class DogDto extends PetBaseDto implements PetDto permits WorkingD
@Getter
@RequiredArgsConstructor
public enum BreedEnum {
DINGO("Dingo"),
HUSKY("Husky"),
RETRIEVER("Retriever"),
SHEPHERD("Shepherd");
Dingo("Dingo"),
Husky("Husky"),
Retriever("Retriever"),
Shepherd("Shepherd");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
@Getter
@RequiredArgsConstructor
public enum WorkingDogCapabilityDto {
GUIDE("Guide"),
RESCUE("Rescue"),
SEARCH("Search");
Guide("Guide"),
Rescue("Rescue"),
Search("Search");

private final String value;

Expand Down
Loading

0 comments on commit 7e9b8c9

Please sign in to comment.