/**
* OpenAPI definition
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
import {ApiClient} from "../ApiClient.js";
/**
* Oauth2Controller service.
* @module api/Oauth2ControllerApi
* @version v0
*/
export class Oauth2ControllerApi {
/**
* Constructs a new Oauth2ControllerApi.
* @alias module:api/Oauth2ControllerApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
constructor(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
}
/**
* This endpoint requires both user name and authentication provider id (fb, github, google... as defined in app properties file). The framework then performs authentication through a series of on-site and off-site redirects. Only after successful Oauth2 authentication with external provider, the browser lands here. This method fetches or creates the Client object, and redirect back to the referring page. Client object is stored in HttpSession, under key specified by clientFactory.clientAttribute().
* This endpoint requires both user name and authentication provider id (fb, github, google... as defined in app properties file). The framework then performs authentication through a series of on-site and off-site redirects. Only after successful Oauth2 authentication with external provider, the browser lands here. This method fetches or creates the Client object, and redirect back to the referring page. Client object is stored in HttpSession, under key specified by clientFactory.clientAttribute().
* @param {String} name Login name of the user, local
* @param {String} provider Oauth2 authentication provider id , as registered in properties file (e.g. github, facebook, google)
* @param {String} avatar Optional avatar URI, used only when creating a new user
* @return {Promise< String >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link String} and HTTP response
*/
afterAuthenticationWithHttpInfo(name, provider, avatar) {
let postBody = null;
// verify the required parameter 'name' is set
if (name === undefined || name === null) {
throw new Error("Missing the required parameter 'name' when calling afterAuthentication");
}
// verify the required parameter 'provider' is set
if (provider === undefined || provider === null) {
throw new Error("Missing the required parameter 'provider' when calling afterAuthentication");
}
// verify the required parameter 'avatar' is set
if (avatar === undefined || avatar === null) {
throw new Error("Missing the required parameter 'avatar' when calling afterAuthentication");
}
let pathParams = {
};
let queryParams = {
'name': name,
'provider': provider,
'avatar': avatar
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = [];
let accepts = ['*/*'];
let returnType = 'String';
return this.apiClient.callApi(
'/vrspace/api/oauth2/login', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null
);
}
/**
* This endpoint requires both user name and authentication provider id (fb, github, google... as defined in app properties file). The framework then performs authentication through a series of on-site and off-site redirects. Only after successful Oauth2 authentication with external provider, the browser lands here. This method fetches or creates the Client object, and redirect back to the referring page. Client object is stored in HttpSession, under key specified by clientFactory.clientAttribute().
* This endpoint requires both user name and authentication provider id (fb, github, google... as defined in app properties file). The framework then performs authentication through a series of on-site and off-site redirects. Only after successful Oauth2 authentication with external provider, the browser lands here. This method fetches or creates the Client object, and redirect back to the referring page. Client object is stored in HttpSession, under key specified by clientFactory.clientAttribute().
* @param {String} name Login name of the user, local
* @param {String} provider Oauth2 authentication provider id , as registered in properties file (e.g. github, facebook, google)
* @param {String} avatar Optional avatar URI, used only when creating a new user
* @return {Promise< String >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link String}
*/
afterAuthentication(name, provider, avatar) {
return this.afterAuthenticationWithHttpInfo(name, provider, avatar)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List of OAuth2 registered authentication providers.
* List of OAuth2 registered authentication providers.
* @return {Promise< Object.<String, {String: String}> >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Object.<String, {String: String}>} and HTTP response
*/
providersWithHttpInfo() {
let postBody = null;
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = [];
let accepts = ['*/*'];
let returnType = {'String': 'String'};
return this.apiClient.callApi(
'/vrspace/api/oauth2/providers', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null
);
}
/**
* List of OAuth2 registered authentication providers.
* List of OAuth2 registered authentication providers.
* @return {Promise< Object.<String, {String: String}> >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Object.<String, {String: String}>}
*/
providers() {
return this.providersWithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* First step in Oauth2 Authentication is to obtain valid authentication provider id.
* First step in Oauth2 Authentication is to obtain valid authentication provider id. This is never called directly though, the browser is redirected here from the login page. Obtains the provider id from the original request and sends browser redirect.
* @return {Promise< String >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link String} and HTTP response
*/
setProviderWithHttpInfo() {
let postBody = null;
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = [];
let accepts = ['*/*'];
let returnType = 'String';
return this.apiClient.callApi(
'/vrspace/api/oauth2/provider', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null
);
}
/**
* First step in Oauth2 Authentication is to obtain valid authentication provider id.
* First step in Oauth2 Authentication is to obtain valid authentication provider id. This is never called directly though, the browser is redirected here from the login page. Obtains the provider id from the original request and sends browser redirect.
* @return {Promise< String >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link String}
*/
setProvider() {
return this.setProviderWithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
}