Base bean for a configured federated login provider that a website or organisation can use for social login. Wraps the settings needed to redirect a user to a remote OAuth2 (or Twitter) authorisation endpoint and to map the returned profile data back onto a Kademi profile. Concrete subclasses supply the actual URL-building logic - OAuth2ProviderBean for generic OAuth2 providers, TwitterProviderBean for Twitter's OAuth1-style flow. Instances are produced from persisted provider settings via toBean, or loaded as built-in provider templates from the oauth.providers Spring bean.
Properties
| Property | Returns | Description |
|---|---|---|
| displayNamePath | String | Path used to extract a display name from the JSON profile data returned by the remote provider, for example "name". May be null if the provider does not supply one, in which case callers such as OAuth2Details fall back to a default. |
| providerId | String | Unique identifier for this provider instance, used as the map key when looking up configured providers and passed through the OAuth2 state parameter to identify which provider initiated the flow. |
| providerTypeId | String | Identifier for the kind of provider this is, for example "oauth2" or "twitter". Distinguishes generic OAuth2 providers from provider-specific implementations such as Twitter's OAuth1-style flow. |
| remoteUserIdPath | String | Path used to extract the remote user's unique identifier from the JSON profile data returned by the remote provider. May be null if the provider does not supply one. |
Methods
getOAuth2URL(String returnUrl, Map<String,String> extraStateParameters)
Returns: URL
Builds the URL that starts this provider's authorisation flow, redirecting the browser back to returnUrl once the remote provider grants access. Implementations may return null if the provider is not fully configured, and may throw a RuntimeException if the request to the remote provider fails.
| Parameter | Description |
|---|---|
returnUrl | the URL to redirect back to after authorisation completes |
extraStateParameters | extra key/value pairs to round-trip through the provider's state parameter |
getProviderId()
Returns: String
Unique identifier for this provider instance, used as the map key when looking up configured providers and passed through the OAuth2 state parameter to identify which provider initiated the flow.
getProviderTypeId()
Returns: String
Identifier for the kind of provider this is, for example "oauth2" or "twitter". Distinguishes generic OAuth2 providers from provider-specific implementations such as Twitter's OAuth1-style flow.
getDisplayNamePath()
Returns: String
Path used to extract a display name from the JSON profile data returned by the remote provider, for example "name". May be null if the provider does not supply one, in which case callers such as OAuth2Details fall back to a default.
getRemoteUserIdPath()
Returns: String
Path used to extract the remote user's unique identifier from the JSON profile data returned by the remote provider. May be null if the provider does not supply one.