public class ConnectSupport extends Object
ConnectController
and ProviderSignInController
.Constructor and Description |
---|
ConnectSupport() |
ConnectSupport(SessionStrategy sessionStrategy) |
Modifier and Type | Method and Description |
---|---|
String |
buildOAuthUrl(ConnectionFactory<?> connectionFactory,
NativeWebRequest request)
Builds the provider URL to redirect the user to for connection authorization.
|
String |
buildOAuthUrl(ConnectionFactory<?> connectionFactory,
NativeWebRequest request,
MultiValueMap<String,String> additionalParameters)
Builds the provider URL to redirect the user to for connection authorization.
|
protected String |
callbackUrl(NativeWebRequest request) |
Connection<?> |
completeConnection(OAuth1ConnectionFactory<?> connectionFactory,
NativeWebRequest request)
Complete the connection to the OAuth1 provider.
|
Connection<?> |
completeConnection(OAuth2ConnectionFactory<?> connectionFactory,
NativeWebRequest request)
Complete the connection to the OAuth2 provider.
|
void |
setApplicationUrl(String applicationUrl)
Configures the base secure URL for the application this controller is being used in e.g.
|
void |
setCallbackUrl(String callbackUrl)
Configures a specific callback URL that is to be used instead of calculating one based on the application URL or current request URL.
|
void |
setUseAuthenticateUrl(boolean useAuthenticateUrl)
Flag indicating if this instance will support OAuth-based authentication instead of the traditional user authorization.
|
public ConnectSupport()
public ConnectSupport(SessionStrategy sessionStrategy)
public void setUseAuthenticateUrl(boolean useAuthenticateUrl)
oauthUrl
return this authenticate URL.useAuthenticateUrl
- whether to use the authenticat url or notOAuth1Operations.buildAuthenticateUrl(String, OAuth1Parameters)
,
OAuth2Operations.buildAuthenticateUrl(OAuth2Parameters)
public void setApplicationUrl(String applicationUrl)
https://myapp.com
. Defaults to null.
If specified, will be used to generate OAuth callback URLs.
If not specified, OAuth callback URLs are generated from HttpServletRequests
.
You may wish to set this property if requests into your application flow through a proxy to your application server.
In this case, the HttpServletRequest URI may contain a scheme, host, and/or port value that points to an internal server not appropriate for an external callback URL.
If you have this problem, you can set this property to the base external URL for your application and it will be used to construct the callback URL instead.applicationUrl
- the application URL valuepublic void setCallbackUrl(String callbackUrl)
callbackUrl
- the callback URL to send to providers during authorization. Default is null.public String buildOAuthUrl(ConnectionFactory<?> connectionFactory, NativeWebRequest request)
connectionFactory
- the service provider's connection factory e.g. FacebookConnectionFactoryrequest
- the current web requestIllegalArgumentException
- if the connection factory is not OAuth1 based.public String buildOAuthUrl(ConnectionFactory<?> connectionFactory, NativeWebRequest request, MultiValueMap<String,String> additionalParameters)
connectionFactory
- the service provider's connection factory e.g. FacebookConnectionFactoryrequest
- the current web requestadditionalParameters
- parameters to add to the authorization URL.IllegalArgumentException
- if the connection factory is not OAuth1 based.public Connection<?> completeConnection(OAuth1ConnectionFactory<?> connectionFactory, NativeWebRequest request)
connectionFactory
- the service provider's connection factory e.g. FacebookConnectionFactoryrequest
- the current web requestpublic Connection<?> completeConnection(OAuth2ConnectionFactory<?> connectionFactory, NativeWebRequest request)
connectionFactory
- the service provider's connection factory e.g. FacebookConnectionFactoryrequest
- the current web requestprotected String callbackUrl(NativeWebRequest request)