2021-08-20 10:58:07 -07:00
|
|
|
package auth.sso;
|
2021-08-20 07:42:18 -07:00
|
|
|
|
|
|
|
import org.pac4j.core.client.Client;
|
|
|
|
|
2023-12-06 11:02:42 +05:30
|
|
|
/** A thin interface over a Pac4j {@link Client} object and its associated configurations. */
|
2021-08-20 07:42:18 -07:00
|
|
|
public interface SsoProvider<C extends SsoConfigs> {
|
|
|
|
|
2023-12-06 11:02:42 +05:30
|
|
|
/** The protocol used for SSO. */
|
2021-08-20 07:42:18 -07:00
|
|
|
enum SsoProtocol {
|
|
|
|
OIDC("oidc");
|
|
|
|
// SAML -- not yet supported.
|
|
|
|
|
|
|
|
// Common name appears in the Callback URL itself.
|
2024-10-28 09:05:16 -05:00
|
|
|
private final String commonName;
|
2021-08-20 07:42:18 -07:00
|
|
|
|
|
|
|
public String getCommonName() {
|
2024-10-28 09:05:16 -05:00
|
|
|
return commonName;
|
2021-08-20 07:42:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
SsoProtocol(String commonName) {
|
2024-10-28 09:05:16 -05:00
|
|
|
this.commonName = commonName;
|
2021-08-20 07:42:18 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-06 11:02:42 +05:30
|
|
|
/** Returns the configs required by the provider. */
|
2021-08-20 07:42:18 -07:00
|
|
|
C configs();
|
|
|
|
|
2023-12-06 11:02:42 +05:30
|
|
|
/** Returns the SSO protocol associated with the provider instance. */
|
2021-08-20 07:42:18 -07:00
|
|
|
SsoProtocol protocol();
|
|
|
|
|
2023-12-06 11:02:42 +05:30
|
|
|
/** Retrieves an initialized Pac4j {@link Client}. */
|
2024-10-28 09:05:16 -05:00
|
|
|
Client client();
|
2021-08-20 07:42:18 -07:00
|
|
|
}
|