OAuthSettings.userSession - multiple declarations

Function OAuthSettings.userSession

User login helper method, complementary to userAuthUri.

final OAuthSession userSession (
  scope vibe.http.session.Session httpSession,
  string state,
  string authorizationCode
) @safe immutable;

Use this method to start a session with user impersonation. The authorizationCode MUST be obtained by redirection of the user agent to an URI obtained through userAuthUri, otherwise there would not be a valid state.

Parameters

NameDescription
httpSession The current HTTP session.
state OAuth state obtained from the 'state' query string parameter of the request URL.
authorizationCode the authorization code obtained from the service. It will be in the 'code' parameter in the query string of the request being processed.

Returns

The new session.

Throws

OAuthException if any of the latter two arguments is invalid or authentication fails otherwise.

Function OAuthSettings.userSession

Start a session on behalf of the resource owner, using username and password for authentication.

final OAuthSession userSession (
  string username,
  string password,
  string[] scopes
) @safe immutable;

This authentication flow SHOULD be used only as a last resort, as it requires exposal of the plain username and password to the client.

Parameters

NameDescription
username The resource owner's username.
password The resource owner's password.
scopes An array of strings representing the scope of the authorization request. (may be null)

Throws

OAuthException if user authentication fails or the client could not be granted access on behalf of the resource owner for any scope requested.