Skip to content

Commit

Permalink
Add ux_mode to allow sign-in when not already
Browse files Browse the repository at this point in the history
  • Loading branch information
philsmart committed Oct 17, 2023
1 parent 204ccae commit 8b9ceb0
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 41 deletions.
2 changes: 1 addition & 1 deletion fedcm-idp/src/main/resources/templates/idp/reauth.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<body style="margin: 10px">

<div style="text-align: center">
<h1>Identity Provider Reauthentication</h1>
<h1>Identity Provider Sign in</h1>
</div>

<div id="steps-outer">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,72 +28,65 @@ public class IdentityCredentialRequestOptions {

private final IdentityCredentialRequestOptionsContext context;

/**
* @return the providers
*/
@JsonProperty("providers")
public final List<IdentityProviderConfig> getProviders() {
return providers;
}

@JsonProperty("context")
public final String getContext() {
return context.getName();
}
private final String mode;


private IdentityCredentialRequestOptions(Builder builder) {
this.providers = builder.providers;
this.context = builder.context;
this.mode = builder.mode;
}


public static IProvidersStage builder() {
return new Builder();
/**
* @return the providers
*/
@JsonProperty("providers")
public final List<IdentityProviderConfig> getProviders() {
return providers;
}


public interface IProvidersStage {
public IBuildStage withProviders(List<IdentityProviderConfig> providers);
@JsonProperty("context")
public final String getContext() {
return context.getName();
}

@JsonProperty("mode")
public final String getMode() {
return mode;
}


public interface IBuildStage {
public IBuildStage withContext(IdentityCredentialRequestOptionsContext context);

public IdentityCredentialRequestOptions build();

public static Builder builder() {
return new Builder();
}

@JsonPOJOBuilder(buildMethodName = "build", withPrefix = "with")
public static final class Builder implements IProvidersStage, IBuildStage {
public static final class Builder {
private List<IdentityProviderConfig> providers = Collections.emptyList();
private IdentityCredentialRequestOptionsContext context = IdentityCredentialRequestOptionsContext.SIGNIN;
private IdentityCredentialRequestOptionsContext context;
private String mode;

private Builder() {
}

@Override
public IBuildStage withProviders(List<IdentityProviderConfig> providers) {
public Builder withProviders(List<IdentityProviderConfig> providers) {
this.providers = providers;
return this;
}

@Override
public IBuildStage withContext(IdentityCredentialRequestOptionsContext context) {
public Builder withContext(IdentityCredentialRequestOptionsContext context) {
this.context = context;
return this;
}

@Override
public Builder withMode(String mode) {
this.mode = mode;
return this;
}

public IdentityCredentialRequestOptions build() {
return new IdentityCredentialRequestOptions(this);
}

}

@Override
public String toString() {
return "IdentityCredentialRequestOptions [providers=" + providers + ", context=" + context + "]";
}


}
2 changes: 1 addition & 1 deletion fedcm-proxy/src/main/resources/templates/proxy/reauth.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<body style="margin: 10px">

<div style="text-align: center">
<h1>Proxy Reauthentication</h1>
<h1>Proxy Sign in</h1>
</div>
</body>

Expand Down
2 changes: 1 addition & 1 deletion fedcm-rp/src/main/resources/application-rp.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ server.ssl.key-store-password=changeit
## FedCM Generic properties

## FedCM RP properties
fedcm.rp.idpConfig=classpath:/identity-provider-config.json
fedcm.rp.idpConfig=classpath:/identity-provider-config-signin.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"scope": []
}
],
"mode" : "button",
"context": "signin"
}}
18 changes: 18 additions & 0 deletions fedcm-rp/src/main/resources/identity-provider-config-signin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{"identity":{
"providers": [
{
"configURL": "http://idp.localhost:8080/idp/fedcm.json",
"clientId": "https://test.rp.org/",
"nonce": "c2f39aba-b17e-4c38-93ea-34293dfde025",
"scope": [
"profile",
"scopes",
"newscope"
]
}
],
"mode" : "button",
"context": "continue"
}}


1 change: 1 addition & 0 deletions fedcm-rp/src/main/resources/identity-provider-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
]
}
],
"mode" : "widget",
"context": "continue"
}}

Expand Down
3 changes: 2 additions & 1 deletion fedcm-rp/src/main/resources/templates/rp.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ <h4 style="text-align: center">FedCM Login Steps
<!-- <iframe src="http://idp.localhost:8080/login-button" allow="identity-credentials-get">
</iframe>-->
<button onclick="login()">Login (FedCM)</button>
<button onclick="login()">Login (FedCM)</button>

</div>

<div id="token-inner">
Expand Down

0 comments on commit 8b9ceb0

Please sign in to comment.