diff --git a/api/auth/auth_models/user.go b/api/auth/auth_models/user.go index 97c29f4..09a5256 100644 --- a/api/auth/auth_models/user.go +++ b/api/auth/auth_models/user.go @@ -155,6 +155,9 @@ type User struct { // Profile ProfileID string `json:"ProfileID,omitempty"` + // Provider + Provider string `json:"Provider,omitempty"` + // Info Emails ReceivesAdminEmails bool `json:"ReceivesAdminEmails,omitempty"` diff --git a/api/crm/crm_client/accounts/accounts_client.go b/api/crm/crm_client/accounts/accounts_client.go index bc09d94..f93fa8e 100644 --- a/api/crm/crm_client/accounts/accounts_client.go +++ b/api/crm/crm_client/accounts/accounts_client.go @@ -48,7 +48,7 @@ type ClientService interface { /* DeleteAccount deletes an account -Delete SalesforceDevops.net Account record +Delete WorkDifferentWithAI.com Account record */ func (a *Client) DeleteAccount(params *DeleteAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAccountOK, error) { // TODO: Validate the params before sending @@ -128,7 +128,7 @@ func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientA } /* -PostAccounts adds a new account to salesforce devops net +PostAccounts adds a new account to work different with a i com Account record to be added */ diff --git a/api/crm/crm_client/assets/assets_client.go b/api/crm/crm_client/assets/assets_client.go index be47bed..f5ad96d 100644 --- a/api/crm/crm_client/assets/assets_client.go +++ b/api/crm/crm_client/assets/assets_client.go @@ -48,7 +48,7 @@ type ClientService interface { /* DeleteAsset deletes an asset -Delete SalesforceDevops.net Asset record +Delete WorkDifferentWithAI.com Asset record */ func (a *Client) DeleteAsset(params *DeleteAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAssetOK, error) { // TODO: Validate the params before sending @@ -128,7 +128,7 @@ func (a *Client) GetAssets(params *GetAssetsParams, authInfo runtime.ClientAuthI } /* -PostAssets adds a new asset to salesforce devops net +PostAssets adds a new asset to work different with a i com Asset record to be added */ diff --git a/api/crm/crm_client/contacts/contacts_client.go b/api/crm/crm_client/contacts/contacts_client.go index 9de72d0..1507ee5 100644 --- a/api/crm/crm_client/contacts/contacts_client.go +++ b/api/crm/crm_client/contacts/contacts_client.go @@ -48,7 +48,7 @@ type ClientService interface { /* DeleteContact deletes a contact -Delete SalesforceDevops.net Contact record +Delete WorkDifferentWithAI.com Contact record */ func (a *Client) DeleteContact(params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContactOK, error) { // TODO: Validate the params before sending diff --git a/api/crm/crm_client/contracts/contracts_client.go b/api/crm/crm_client/contracts/contracts_client.go index ab034e0..f54fdf3 100644 --- a/api/crm/crm_client/contracts/contracts_client.go +++ b/api/crm/crm_client/contracts/contracts_client.go @@ -48,7 +48,7 @@ type ClientService interface { /* DeleteContract deletes an contract -Delete SalesforceDevops.net Contract record +Delete WorkDifferentWithAI.com Contract record */ func (a *Client) DeleteContract(params *DeleteContractParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContractOK, error) { // TODO: Validate the params before sending @@ -128,7 +128,7 @@ func (a *Client) GetContracts(params *GetContractsParams, authInfo runtime.Clien } /* -PostContracts adds a new contract to salesforce devops net +PostContracts adds a new contract to work different with a i com Contract record to be added */ diff --git a/api/crm/crm_client/leads/leads_client.go b/api/crm/crm_client/leads/leads_client.go index faa7c21..8ec3ede 100644 --- a/api/crm/crm_client/leads/leads_client.go +++ b/api/crm/crm_client/leads/leads_client.go @@ -48,7 +48,7 @@ type ClientService interface { /* DeleteLead deletes a contact -Delete SalesforceDevops.net Lead record +Delete WorkDifferentWithAI.com Lead record */ func (a *Client) DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeadOK, error) { // TODO: Validate the params before sending diff --git a/api/members/members_client/users/post_users_auth_parameters.go b/api/members/members_client/users/post_users_auth_parameters.go new file mode 100644 index 0000000..b655364 --- /dev/null +++ b/api/members/members_client/users/post_users_auth_parameters.go @@ -0,0 +1,157 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// (c) 2012-2023 by Vernon Keenan +// All rights reserved worldwide. +// Proprietary product; unlicensed use is not allowed + +package users + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "code.tnxs.net/work/lib/api/members/members_models" +) + +// NewPostUsersAuthParams creates a new PostUsersAuthParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostUsersAuthParams() *PostUsersAuthParams { + return &PostUsersAuthParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostUsersAuthParamsWithTimeout creates a new PostUsersAuthParams object +// with the ability to set a timeout on a request. +func NewPostUsersAuthParamsWithTimeout(timeout time.Duration) *PostUsersAuthParams { + return &PostUsersAuthParams{ + timeout: timeout, + } +} + +// NewPostUsersAuthParamsWithContext creates a new PostUsersAuthParams object +// with the ability to set a context for a request. +func NewPostUsersAuthParamsWithContext(ctx context.Context) *PostUsersAuthParams { + return &PostUsersAuthParams{ + Context: ctx, + } +} + +// NewPostUsersAuthParamsWithHTTPClient creates a new PostUsersAuthParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostUsersAuthParamsWithHTTPClient(client *http.Client) *PostUsersAuthParams { + return &PostUsersAuthParams{ + HTTPClient: client, + } +} + +/* +PostUsersAuthParams contains all the parameters to send to the API endpoint + + for the post users auth operation. + + Typically these are written to a http.Request. +*/ +type PostUsersAuthParams struct { + + /* UserAuthRequest. + + A simple user authentication request + */ + UserAuthRequest *members_models.UserAuth + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post users auth params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostUsersAuthParams) WithDefaults() *PostUsersAuthParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post users auth params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostUsersAuthParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post users auth params +func (o *PostUsersAuthParams) WithTimeout(timeout time.Duration) *PostUsersAuthParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post users auth params +func (o *PostUsersAuthParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post users auth params +func (o *PostUsersAuthParams) WithContext(ctx context.Context) *PostUsersAuthParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post users auth params +func (o *PostUsersAuthParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post users auth params +func (o *PostUsersAuthParams) WithHTTPClient(client *http.Client) *PostUsersAuthParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post users auth params +func (o *PostUsersAuthParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithUserAuthRequest adds the userAuthRequest to the post users auth params +func (o *PostUsersAuthParams) WithUserAuthRequest(userAuthRequest *members_models.UserAuth) *PostUsersAuthParams { + o.SetUserAuthRequest(userAuthRequest) + return o +} + +// SetUserAuthRequest adds the userAuthRequest to the post users auth params +func (o *PostUsersAuthParams) SetUserAuthRequest(userAuthRequest *members_models.UserAuth) { + o.UserAuthRequest = userAuthRequest +} + +// WriteToRequest writes these params to a swagger request +func (o *PostUsersAuthParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.UserAuthRequest != nil { + if err := r.SetBodyParam(o.UserAuthRequest); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/api/members/members_client/users/post_users_auth_password_parameters.go b/api/members/members_client/users/post_users_auth_password_parameters.go new file mode 100644 index 0000000..3583271 --- /dev/null +++ b/api/members/members_client/users/post_users_auth_password_parameters.go @@ -0,0 +1,157 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// (c) 2012-2023 by Vernon Keenan +// All rights reserved worldwide. +// Proprietary product; unlicensed use is not allowed + +package users + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "code.tnxs.net/work/lib/api/members/members_models" +) + +// NewPostUsersAuthPasswordParams creates a new PostUsersAuthPasswordParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostUsersAuthPasswordParams() *PostUsersAuthPasswordParams { + return &PostUsersAuthPasswordParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostUsersAuthPasswordParamsWithTimeout creates a new PostUsersAuthPasswordParams object +// with the ability to set a timeout on a request. +func NewPostUsersAuthPasswordParamsWithTimeout(timeout time.Duration) *PostUsersAuthPasswordParams { + return &PostUsersAuthPasswordParams{ + timeout: timeout, + } +} + +// NewPostUsersAuthPasswordParamsWithContext creates a new PostUsersAuthPasswordParams object +// with the ability to set a context for a request. +func NewPostUsersAuthPasswordParamsWithContext(ctx context.Context) *PostUsersAuthPasswordParams { + return &PostUsersAuthPasswordParams{ + Context: ctx, + } +} + +// NewPostUsersAuthPasswordParamsWithHTTPClient creates a new PostUsersAuthPasswordParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostUsersAuthPasswordParamsWithHTTPClient(client *http.Client) *PostUsersAuthPasswordParams { + return &PostUsersAuthPasswordParams{ + HTTPClient: client, + } +} + +/* +PostUsersAuthPasswordParams contains all the parameters to send to the API endpoint + + for the post users auth password operation. + + Typically these are written to a http.Request. +*/ +type PostUsersAuthPasswordParams struct { + + /* UserAuthRequest. + + A simple user authentication request + */ + UserAuthRequest *members_models.UserAuth + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post users auth password params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostUsersAuthPasswordParams) WithDefaults() *PostUsersAuthPasswordParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post users auth password params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostUsersAuthPasswordParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post users auth password params +func (o *PostUsersAuthPasswordParams) WithTimeout(timeout time.Duration) *PostUsersAuthPasswordParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post users auth password params +func (o *PostUsersAuthPasswordParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post users auth password params +func (o *PostUsersAuthPasswordParams) WithContext(ctx context.Context) *PostUsersAuthPasswordParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post users auth password params +func (o *PostUsersAuthPasswordParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post users auth password params +func (o *PostUsersAuthPasswordParams) WithHTTPClient(client *http.Client) *PostUsersAuthPasswordParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post users auth password params +func (o *PostUsersAuthPasswordParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithUserAuthRequest adds the userAuthRequest to the post users auth password params +func (o *PostUsersAuthPasswordParams) WithUserAuthRequest(userAuthRequest *members_models.UserAuth) *PostUsersAuthPasswordParams { + o.SetUserAuthRequest(userAuthRequest) + return o +} + +// SetUserAuthRequest adds the userAuthRequest to the post users auth password params +func (o *PostUsersAuthPasswordParams) SetUserAuthRequest(userAuthRequest *members_models.UserAuth) { + o.UserAuthRequest = userAuthRequest +} + +// WriteToRequest writes these params to a swagger request +func (o *PostUsersAuthPasswordParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.UserAuthRequest != nil { + if err := r.SetBodyParam(o.UserAuthRequest); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/api/members/members_client/users/post_users_auth_password_responses.go b/api/members/members_client/users/post_users_auth_password_responses.go new file mode 100644 index 0000000..5056e7a --- /dev/null +++ b/api/members/members_client/users/post_users_auth_password_responses.go @@ -0,0 +1,403 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// (c) 2012-2023 by Vernon Keenan +// All rights reserved worldwide. +// Proprietary product; unlicensed use is not allowed + +package users + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "code.tnxs.net/work/lib/api/members/members_models" +) + +// PostUsersAuthPasswordReader is a Reader for the PostUsersAuthPassword structure. +type PostUsersAuthPasswordReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostUsersAuthPasswordReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostUsersAuthPasswordOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPostUsersAuthPasswordUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPostUsersAuthPasswordNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPostUsersAuthPasswordUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPostUsersAuthPasswordInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPostUsersAuthPasswordOK creates a PostUsersAuthPasswordOK with default headers values +func NewPostUsersAuthPasswordOK() *PostUsersAuthPasswordOK { + return &PostUsersAuthPasswordOK{} +} + +/* +PostUsersAuthPasswordOK describes a response with status code 200, with default header values. + +Response with single UserAuth object +*/ +type PostUsersAuthPasswordOK struct { + Payload *members_models.UserAuth +} + +// IsSuccess returns true when this post users auth password o k response has a 2xx status code +func (o *PostUsersAuthPasswordOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post users auth password o k response has a 3xx status code +func (o *PostUsersAuthPasswordOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post users auth password o k response has a 4xx status code +func (o *PostUsersAuthPasswordOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post users auth password o k response has a 5xx status code +func (o *PostUsersAuthPasswordOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post users auth password o k response a status code equal to that given +func (o *PostUsersAuthPasswordOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post users auth password o k response +func (o *PostUsersAuthPasswordOK) Code() int { + return 200 +} + +func (o *PostUsersAuthPasswordOK) Error() string { + return fmt.Sprintf("[POST /users/auth/password][%d] postUsersAuthPasswordOK %+v", 200, o.Payload) +} + +func (o *PostUsersAuthPasswordOK) String() string { + return fmt.Sprintf("[POST /users/auth/password][%d] postUsersAuthPasswordOK %+v", 200, o.Payload) +} + +func (o *PostUsersAuthPasswordOK) GetPayload() *members_models.UserAuth { + return o.Payload +} + +func (o *PostUsersAuthPasswordOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.UserAuth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPostUsersAuthPasswordUnauthorized creates a PostUsersAuthPasswordUnauthorized with default headers values +func NewPostUsersAuthPasswordUnauthorized() *PostUsersAuthPasswordUnauthorized { + return &PostUsersAuthPasswordUnauthorized{} +} + +/* +PostUsersAuthPasswordUnauthorized describes a response with status code 401, with default header values. + +Access Unauthorized, invalid API-KEY was used +*/ +type PostUsersAuthPasswordUnauthorized struct { + Payload *members_models.Error +} + +// IsSuccess returns true when this post users auth password unauthorized response has a 2xx status code +func (o *PostUsersAuthPasswordUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post users auth password unauthorized response has a 3xx status code +func (o *PostUsersAuthPasswordUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post users auth password unauthorized response has a 4xx status code +func (o *PostUsersAuthPasswordUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this post users auth password unauthorized response has a 5xx status code +func (o *PostUsersAuthPasswordUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this post users auth password unauthorized response a status code equal to that given +func (o *PostUsersAuthPasswordUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the post users auth password unauthorized response +func (o *PostUsersAuthPasswordUnauthorized) Code() int { + return 401 +} + +func (o *PostUsersAuthPasswordUnauthorized) Error() string { + return fmt.Sprintf("[POST /users/auth/password][%d] postUsersAuthPasswordUnauthorized %+v", 401, o.Payload) +} + +func (o *PostUsersAuthPasswordUnauthorized) String() string { + return fmt.Sprintf("[POST /users/auth/password][%d] postUsersAuthPasswordUnauthorized %+v", 401, o.Payload) +} + +func (o *PostUsersAuthPasswordUnauthorized) GetPayload() *members_models.Error { + return o.Payload +} + +func (o *PostUsersAuthPasswordUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPostUsersAuthPasswordNotFound creates a PostUsersAuthPasswordNotFound with default headers values +func NewPostUsersAuthPasswordNotFound() *PostUsersAuthPasswordNotFound { + return &PostUsersAuthPasswordNotFound{} +} + +/* +PostUsersAuthPasswordNotFound describes a response with status code 404, with default header values. + +Resource was not found +*/ +type PostUsersAuthPasswordNotFound struct { + Payload *members_models.Error +} + +// IsSuccess returns true when this post users auth password not found response has a 2xx status code +func (o *PostUsersAuthPasswordNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post users auth password not found response has a 3xx status code +func (o *PostUsersAuthPasswordNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post users auth password not found response has a 4xx status code +func (o *PostUsersAuthPasswordNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this post users auth password not found response has a 5xx status code +func (o *PostUsersAuthPasswordNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this post users auth password not found response a status code equal to that given +func (o *PostUsersAuthPasswordNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the post users auth password not found response +func (o *PostUsersAuthPasswordNotFound) Code() int { + return 404 +} + +func (o *PostUsersAuthPasswordNotFound) Error() string { + return fmt.Sprintf("[POST /users/auth/password][%d] postUsersAuthPasswordNotFound %+v", 404, o.Payload) +} + +func (o *PostUsersAuthPasswordNotFound) String() string { + return fmt.Sprintf("[POST /users/auth/password][%d] postUsersAuthPasswordNotFound %+v", 404, o.Payload) +} + +func (o *PostUsersAuthPasswordNotFound) GetPayload() *members_models.Error { + return o.Payload +} + +func (o *PostUsersAuthPasswordNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPostUsersAuthPasswordUnprocessableEntity creates a PostUsersAuthPasswordUnprocessableEntity with default headers values +func NewPostUsersAuthPasswordUnprocessableEntity() *PostUsersAuthPasswordUnprocessableEntity { + return &PostUsersAuthPasswordUnprocessableEntity{} +} + +/* +PostUsersAuthPasswordUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity, likely a bad parameter +*/ +type PostUsersAuthPasswordUnprocessableEntity struct { + Payload *members_models.Error +} + +// IsSuccess returns true when this post users auth password unprocessable entity response has a 2xx status code +func (o *PostUsersAuthPasswordUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post users auth password unprocessable entity response has a 3xx status code +func (o *PostUsersAuthPasswordUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post users auth password unprocessable entity response has a 4xx status code +func (o *PostUsersAuthPasswordUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this post users auth password unprocessable entity response has a 5xx status code +func (o *PostUsersAuthPasswordUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this post users auth password unprocessable entity response a status code equal to that given +func (o *PostUsersAuthPasswordUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the post users auth password unprocessable entity response +func (o *PostUsersAuthPasswordUnprocessableEntity) Code() int { + return 422 +} + +func (o *PostUsersAuthPasswordUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /users/auth/password][%d] postUsersAuthPasswordUnprocessableEntity %+v", 422, o.Payload) +} + +func (o *PostUsersAuthPasswordUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /users/auth/password][%d] postUsersAuthPasswordUnprocessableEntity %+v", 422, o.Payload) +} + +func (o *PostUsersAuthPasswordUnprocessableEntity) GetPayload() *members_models.Error { + return o.Payload +} + +func (o *PostUsersAuthPasswordUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPostUsersAuthPasswordInternalServerError creates a PostUsersAuthPasswordInternalServerError with default headers values +func NewPostUsersAuthPasswordInternalServerError() *PostUsersAuthPasswordInternalServerError { + return &PostUsersAuthPasswordInternalServerError{} +} + +/* +PostUsersAuthPasswordInternalServerError describes a response with status code 500, with default header values. + +Server Internal Error +*/ +type PostUsersAuthPasswordInternalServerError struct { + Payload *members_models.Error +} + +// IsSuccess returns true when this post users auth password internal server error response has a 2xx status code +func (o *PostUsersAuthPasswordInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post users auth password internal server error response has a 3xx status code +func (o *PostUsersAuthPasswordInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post users auth password internal server error response has a 4xx status code +func (o *PostUsersAuthPasswordInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this post users auth password internal server error response has a 5xx status code +func (o *PostUsersAuthPasswordInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this post users auth password internal server error response a status code equal to that given +func (o *PostUsersAuthPasswordInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the post users auth password internal server error response +func (o *PostUsersAuthPasswordInternalServerError) Code() int { + return 500 +} + +func (o *PostUsersAuthPasswordInternalServerError) Error() string { + return fmt.Sprintf("[POST /users/auth/password][%d] postUsersAuthPasswordInternalServerError %+v", 500, o.Payload) +} + +func (o *PostUsersAuthPasswordInternalServerError) String() string { + return fmt.Sprintf("[POST /users/auth/password][%d] postUsersAuthPasswordInternalServerError %+v", 500, o.Payload) +} + +func (o *PostUsersAuthPasswordInternalServerError) GetPayload() *members_models.Error { + return o.Payload +} + +func (o *PostUsersAuthPasswordInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/api/members/members_client/users/post_users_auth_responses.go b/api/members/members_client/users/post_users_auth_responses.go new file mode 100644 index 0000000..ed996f6 --- /dev/null +++ b/api/members/members_client/users/post_users_auth_responses.go @@ -0,0 +1,403 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// (c) 2012-2023 by Vernon Keenan +// All rights reserved worldwide. +// Proprietary product; unlicensed use is not allowed + +package users + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "code.tnxs.net/work/lib/api/members/members_models" +) + +// PostUsersAuthReader is a Reader for the PostUsersAuth structure. +type PostUsersAuthReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostUsersAuthReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostUsersAuthOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPostUsersAuthUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPostUsersAuthNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPostUsersAuthUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPostUsersAuthInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPostUsersAuthOK creates a PostUsersAuthOK with default headers values +func NewPostUsersAuthOK() *PostUsersAuthOK { + return &PostUsersAuthOK{} +} + +/* +PostUsersAuthOK describes a response with status code 200, with default header values. + +Response with single UserAuth object +*/ +type PostUsersAuthOK struct { + Payload *members_models.UserAuth +} + +// IsSuccess returns true when this post users auth o k response has a 2xx status code +func (o *PostUsersAuthOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post users auth o k response has a 3xx status code +func (o *PostUsersAuthOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post users auth o k response has a 4xx status code +func (o *PostUsersAuthOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post users auth o k response has a 5xx status code +func (o *PostUsersAuthOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post users auth o k response a status code equal to that given +func (o *PostUsersAuthOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post users auth o k response +func (o *PostUsersAuthOK) Code() int { + return 200 +} + +func (o *PostUsersAuthOK) Error() string { + return fmt.Sprintf("[POST /users/auth][%d] postUsersAuthOK %+v", 200, o.Payload) +} + +func (o *PostUsersAuthOK) String() string { + return fmt.Sprintf("[POST /users/auth][%d] postUsersAuthOK %+v", 200, o.Payload) +} + +func (o *PostUsersAuthOK) GetPayload() *members_models.UserAuth { + return o.Payload +} + +func (o *PostUsersAuthOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.UserAuth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPostUsersAuthUnauthorized creates a PostUsersAuthUnauthorized with default headers values +func NewPostUsersAuthUnauthorized() *PostUsersAuthUnauthorized { + return &PostUsersAuthUnauthorized{} +} + +/* +PostUsersAuthUnauthorized describes a response with status code 401, with default header values. + +Access Unauthorized, invalid API-KEY was used +*/ +type PostUsersAuthUnauthorized struct { + Payload *members_models.Error +} + +// IsSuccess returns true when this post users auth unauthorized response has a 2xx status code +func (o *PostUsersAuthUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post users auth unauthorized response has a 3xx status code +func (o *PostUsersAuthUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post users auth unauthorized response has a 4xx status code +func (o *PostUsersAuthUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this post users auth unauthorized response has a 5xx status code +func (o *PostUsersAuthUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this post users auth unauthorized response a status code equal to that given +func (o *PostUsersAuthUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the post users auth unauthorized response +func (o *PostUsersAuthUnauthorized) Code() int { + return 401 +} + +func (o *PostUsersAuthUnauthorized) Error() string { + return fmt.Sprintf("[POST /users/auth][%d] postUsersAuthUnauthorized %+v", 401, o.Payload) +} + +func (o *PostUsersAuthUnauthorized) String() string { + return fmt.Sprintf("[POST /users/auth][%d] postUsersAuthUnauthorized %+v", 401, o.Payload) +} + +func (o *PostUsersAuthUnauthorized) GetPayload() *members_models.Error { + return o.Payload +} + +func (o *PostUsersAuthUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPostUsersAuthNotFound creates a PostUsersAuthNotFound with default headers values +func NewPostUsersAuthNotFound() *PostUsersAuthNotFound { + return &PostUsersAuthNotFound{} +} + +/* +PostUsersAuthNotFound describes a response with status code 404, with default header values. + +Resource was not found +*/ +type PostUsersAuthNotFound struct { + Payload *members_models.Error +} + +// IsSuccess returns true when this post users auth not found response has a 2xx status code +func (o *PostUsersAuthNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post users auth not found response has a 3xx status code +func (o *PostUsersAuthNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post users auth not found response has a 4xx status code +func (o *PostUsersAuthNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this post users auth not found response has a 5xx status code +func (o *PostUsersAuthNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this post users auth not found response a status code equal to that given +func (o *PostUsersAuthNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the post users auth not found response +func (o *PostUsersAuthNotFound) Code() int { + return 404 +} + +func (o *PostUsersAuthNotFound) Error() string { + return fmt.Sprintf("[POST /users/auth][%d] postUsersAuthNotFound %+v", 404, o.Payload) +} + +func (o *PostUsersAuthNotFound) String() string { + return fmt.Sprintf("[POST /users/auth][%d] postUsersAuthNotFound %+v", 404, o.Payload) +} + +func (o *PostUsersAuthNotFound) GetPayload() *members_models.Error { + return o.Payload +} + +func (o *PostUsersAuthNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPostUsersAuthUnprocessableEntity creates a PostUsersAuthUnprocessableEntity with default headers values +func NewPostUsersAuthUnprocessableEntity() *PostUsersAuthUnprocessableEntity { + return &PostUsersAuthUnprocessableEntity{} +} + +/* +PostUsersAuthUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity, likely a bad parameter +*/ +type PostUsersAuthUnprocessableEntity struct { + Payload *members_models.Error +} + +// IsSuccess returns true when this post users auth unprocessable entity response has a 2xx status code +func (o *PostUsersAuthUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post users auth unprocessable entity response has a 3xx status code +func (o *PostUsersAuthUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post users auth unprocessable entity response has a 4xx status code +func (o *PostUsersAuthUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this post users auth unprocessable entity response has a 5xx status code +func (o *PostUsersAuthUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this post users auth unprocessable entity response a status code equal to that given +func (o *PostUsersAuthUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the post users auth unprocessable entity response +func (o *PostUsersAuthUnprocessableEntity) Code() int { + return 422 +} + +func (o *PostUsersAuthUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /users/auth][%d] postUsersAuthUnprocessableEntity %+v", 422, o.Payload) +} + +func (o *PostUsersAuthUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /users/auth][%d] postUsersAuthUnprocessableEntity %+v", 422, o.Payload) +} + +func (o *PostUsersAuthUnprocessableEntity) GetPayload() *members_models.Error { + return o.Payload +} + +func (o *PostUsersAuthUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPostUsersAuthInternalServerError creates a PostUsersAuthInternalServerError with default headers values +func NewPostUsersAuthInternalServerError() *PostUsersAuthInternalServerError { + return &PostUsersAuthInternalServerError{} +} + +/* +PostUsersAuthInternalServerError describes a response with status code 500, with default header values. + +Server Internal Error +*/ +type PostUsersAuthInternalServerError struct { + Payload *members_models.Error +} + +// IsSuccess returns true when this post users auth internal server error response has a 2xx status code +func (o *PostUsersAuthInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post users auth internal server error response has a 3xx status code +func (o *PostUsersAuthInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post users auth internal server error response has a 4xx status code +func (o *PostUsersAuthInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this post users auth internal server error response has a 5xx status code +func (o *PostUsersAuthInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this post users auth internal server error response a status code equal to that given +func (o *PostUsersAuthInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the post users auth internal server error response +func (o *PostUsersAuthInternalServerError) Code() int { + return 500 +} + +func (o *PostUsersAuthInternalServerError) Error() string { + return fmt.Sprintf("[POST /users/auth][%d] postUsersAuthInternalServerError %+v", 500, o.Payload) +} + +func (o *PostUsersAuthInternalServerError) String() string { + return fmt.Sprintf("[POST /users/auth][%d] postUsersAuthInternalServerError %+v", 500, o.Payload) +} + +func (o *PostUsersAuthInternalServerError) GetPayload() *members_models.Error { + return o.Payload +} + +func (o *PostUsersAuthInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/api/members/members_client/users/users_client.go b/api/members/members_client/users/users_client.go index c70f6f1..75dea8b 100644 --- a/api/members/members_client/users/users_client.go +++ b/api/members/members_client/users/users_client.go @@ -38,6 +38,10 @@ type ClientService interface { PostUsers(params *PostUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostUsersOK, error) + PostUsersAuth(params *PostUsersAuthParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostUsersAuthOK, error) + + PostUsersAuthPassword(params *PostUsersAuthPasswordParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostUsersAuthPasswordOK, error) + PostUsersOnboard(params *PostUsersOnboardParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostUsersOnboardOK, error) PutUsers(params *PutUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutUsersOK, error) @@ -127,6 +131,88 @@ func (a *Client) PostUsers(params *PostUsersParams, authInfo runtime.ClientAuthI panic(msg) } +/* +PostUsersAuth authenticates a user + +Authenticate a user +*/ +func (a *Client) PostUsersAuth(params *PostUsersAuthParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostUsersAuthOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostUsersAuthParams() + } + op := &runtime.ClientOperation{ + ID: "postUsersAuth", + Method: "POST", + PathPattern: "/users/auth", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostUsersAuthReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostUsersAuthOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for postUsersAuth: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostUsersAuthPassword changes user password + +Change user password +*/ +func (a *Client) PostUsersAuthPassword(params *PostUsersAuthPasswordParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostUsersAuthPasswordOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostUsersAuthPasswordParams() + } + op := &runtime.ClientOperation{ + ID: "postUsersAuthPassword", + Method: "POST", + PathPattern: "/users/auth/password", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostUsersAuthPasswordReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostUsersAuthPasswordOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for postUsersAuthPassword: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* PostUsersOnboard asyncs onboard new users diff --git a/api/members/members_models/clerk_user.go b/api/members/members_models/clerk_user.go deleted file mode 100644 index 12244f3..0000000 --- a/api/members/members_models/clerk_user.go +++ /dev/null @@ -1,270 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// (c) 2012-2023 by Vernon Keenan -// All rights reserved worldwide. -// Proprietary product; unlicensed use is not allowed - -package members_models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// ClerkUser Clerk user object -// -// swagger:model ClerkUser -type ClerkUser struct { - - // If Backup Codes are configured on the instance, you can provide them to enable it on the newly created user without the need to reset them. - // You must provide the backup codes in plain format or the corresponding bcrypt digest. - BackupCodes []string `json:"backup_codes"` - - // A custom date/time denoting _when_ the user signed up to the application, specified in RFC3339 format (e.g. `2012-10-20T07:15:20.902Z`). - CreatedAt *string `json:"created_at,omitempty"` - - // Email addresses to add to the user. - // Must be unique across your instance. - // The first email address will be set as the user's primary email address. - EmailAddress []string `json:"email_address"` - - // The ID of the user as used in your external systems or your previous authentication solution. - // Must be unique across your instance. - ExternalID *string `json:"external_id,omitempty"` - - // The first name to assign to the user - FirstName *string `json:"first_name,omitempty"` - - // The last name to assign to the user - LastName *string `json:"last_name,omitempty"` - - // The plaintext password to give the user. - // Must be at least 8 characters long, and can not be in any list of hacked passwords. - Password *string `json:"password,omitempty"` - - // In case you already have the password digests and not the passwords, you can use them for the newly created user via this property. - // The digests should be generated with one of the supported algorithms. - // The hashing algorithm can be specified using the `password_hasher` property. - PasswordDigest *string `json:"password_digest,omitempty"` - - // The hashing algorithm that was used to generate the password digest. - // The algorithms we support at the moment are [bcrypt](https://en.wikipedia.org/wiki/Bcrypt), md5, pbkdf2_sha256, [pbkdf2_sha256_django](https://docs.djangoproject.com/en/4.0/topics/auth/passwords/), [scrypt_firebase](https://firebaseopensource.com/projects/firebase/scrypt/) and 2 [argon2](https://argon2.online/) variants, argon2i and argon2id. - // Each of the above expects the incoming digest to be of a particular format. - // - // More specifically: - // - // **bcrypt:** The digest should be of the following form: - // - // `$$$` - // - // **md5:** The digest should follow the regular form e.g.: - // - // `5f4dcc3b5aa765d61d8327deb882cf99` - // - // **pbkdf2_sha256:** This is the PBKDF2 algorithm using the SHA256 hashing function. The format should be as follows: - // - // `pbkdf2_sha256$$$` - // - // Note: Both the salt and the hash are expected to be base64-encoded. - // - // **pbkdf2_sha256_django:** This is the Django-specific variant of PBKDF2 and the digest should have the following format (as exported from Django): - // - // `pbkdf2_sha256$$$` - // - // Note: The salt is expected to be un-encoded, the hash is expected base64-encoded. - // - // **pbkdf2_sha1:** This is similar to pkbdf2_sha256_django, but with two differences: - // 1. uses sha1 instead of sha256 - // 2. accepts the hash as a hex-encoded string - // - // The format is the following: - // - // `pbkdf2_sha1$$$` - // - // - // **scrypt_firebase:** The Firebase-specific variant of scrypt. - // The value is expected to have 6 segments separated by the $ character and include the following information: - // - // _hash:_ The actual Base64 hash. This can be retrieved when exporting the user from Firebase. - // _salt:_ The salt used to generate the above hash. Again, this is given when exporting the user. - // _signer key:_ The base64 encoded signer key. - // _salt separator:_ The base64 encoded salt separator. - // _rounds:_ The number of rounds the algorithm needs to run. - // _memory cost:_ The cost of the algorithm run - // - // The first 2 (hash and salt) are per user and can be retrieved when exporting the user from Firebase. - // The other 4 values (signer key, salt separator, rounds and memory cost) are project-wide settings and can be retrieved from the project's password hash parameters. - // - // Once you have all these, you can combine it in the following format and send this as the digest in order for Clerk to accept it: - // - // `$$$$$` - // - // **argon2i:** Algorithms in the argon2 family generate digests that encode the following information: - // - // _version (v):_ The argon version, version 19 is assumed - // _memory (m):_ The memory used by the algorithm (in kibibytes) - // _iterations (t):_ The number of iterations to perform - // _parallelism (p):_ The number of threads to use - // - // Parts are demarcated by the `$` character, with the first part identifying the algorithm variant. - // The middle part is a comma-separated list of the encoding options (memory, iterations, parallelism). - // The final part is the actual digest. - // - // `$argon2i$v=19$m=4096,t=3,p=1$4t6CL3P7YiHBtwESXawI8Hm20zJj4cs7/4/G3c187e0$m7RQFczcKr5bIR0IIxbpO2P0tyrLjf3eUW3M3QSwnLc` - // - // **argon2id:** See the previous algorithm for an explanation of the formatting. - // - // For the argon2id case, the value of the algorithm in the first part of the digest is `argon2id`: - // - // `$argon2id$v=19$m=64,t=4,p=8$Z2liZXJyaXNo$iGXEpMBTDYQ8G/71tF0qGjxRHEmR3gpGULcE93zUJVU` - // - // If you need support for any particular hashing algorithm, [please let us know](https://clerk.com/support). - // Enum: [bcrypt md5 pbkdf2_sha256 pbkdf2_sha256_django pbkdf2_sha1 scrypt_firebase argon2i argon2id] - PasswordHasher *string `json:"password_hasher,omitempty"` - - // Phone numbers to add to the user. - // Must be unique across your instance. - // The first phone number will be set as the user's primary phone number. - PhoneNumber []string `json:"phone_number"` - - // Metadata saved on the user, that is only visible to your Backend API - PrivateMetadata interface{} `json:"private_metadata,omitempty"` - - // Metadata saved on the user, that is visible to both your Frontend and Backend APIs - PublicMetadata interface{} `json:"public_metadata,omitempty"` - - // When set to `true` all password checks are skipped. - // It is recommended to use this method only when migrating plaintext passwords to Clerk. - // Upon migration the user base should be prompted to pick stronger password. - SkipPasswordChecks bool `json:"skip_password_checks,omitempty"` - - // When set to `true`, `password` is not required anymore when creating the user and can be omitted. - // This is useful when you are trying to create a user that doesn't have a password, in an instance that is using passwords. - // Please note that you cannot use this flag if password is the only way for a user to sign into your instance. - SkipPasswordRequirement bool `json:"skip_password_requirement,omitempty"` - - // In case TOTP is configured on the instance, you can provide the secret to enable it on the newly created user without the need to reset it. - // Please note that currently the supported options are: - // * Period: 30 seconds - // * Code length: 6 digits - // * Algorithm: SHA1 - TotpSecret *string `json:"totp_secret,omitempty"` - - // Metadata saved on the user, that can be updated from both the Frontend and Backend APIs. - // Note: Since this data can be modified from the frontend, it is not guaranteed to be safe. - UnsafeMetadata interface{} `json:"unsafe_metadata,omitempty"` - - // The username to give to the user. - // It must be unique across your instance. - Username *string `json:"username,omitempty"` - - // Web3 wallets to add to the user. - // Must be unique across your instance. - // The first wallet will be set as the user's primary wallet. - Web3Wallet []string `json:"web3_wallet"` -} - -// Validate validates this clerk user -func (m *ClerkUser) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePasswordHasher(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var clerkUserTypePasswordHasherPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["bcrypt","md5","pbkdf2_sha256","pbkdf2_sha256_django","pbkdf2_sha1","scrypt_firebase","argon2i","argon2id"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - clerkUserTypePasswordHasherPropEnum = append(clerkUserTypePasswordHasherPropEnum, v) - } -} - -const ( - - // ClerkUserPasswordHasherBcrypt captures enum value "bcrypt" - ClerkUserPasswordHasherBcrypt string = "bcrypt" - - // ClerkUserPasswordHasherMd5 captures enum value "md5" - ClerkUserPasswordHasherMd5 string = "md5" - - // ClerkUserPasswordHasherPbkdf2Sha256 captures enum value "pbkdf2_sha256" - ClerkUserPasswordHasherPbkdf2Sha256 string = "pbkdf2_sha256" - - // ClerkUserPasswordHasherPbkdf2Sha256Django captures enum value "pbkdf2_sha256_django" - ClerkUserPasswordHasherPbkdf2Sha256Django string = "pbkdf2_sha256_django" - - // ClerkUserPasswordHasherPbkdf2Sha1 captures enum value "pbkdf2_sha1" - ClerkUserPasswordHasherPbkdf2Sha1 string = "pbkdf2_sha1" - - // ClerkUserPasswordHasherScryptFirebase captures enum value "scrypt_firebase" - ClerkUserPasswordHasherScryptFirebase string = "scrypt_firebase" - - // ClerkUserPasswordHasherArgon2i captures enum value "argon2i" - ClerkUserPasswordHasherArgon2i string = "argon2i" - - // ClerkUserPasswordHasherArgon2id captures enum value "argon2id" - ClerkUserPasswordHasherArgon2id string = "argon2id" -) - -// prop value enum -func (m *ClerkUser) validatePasswordHasherEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, clerkUserTypePasswordHasherPropEnum, true); err != nil { - return err - } - return nil -} - -func (m *ClerkUser) validatePasswordHasher(formats strfmt.Registry) error { - if swag.IsZero(m.PasswordHasher) { // not required - return nil - } - - // value enum - if err := m.validatePasswordHasherEnum("password_hasher", "body", *m.PasswordHasher); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this clerk user based on context it is used -func (m *ClerkUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *ClerkUser) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ClerkUser) UnmarshalBinary(b []byte) error { - var res ClerkUser - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/api/members/members_models/user.go b/api/members/members_models/user.go index 16fd3b3..ca63a40 100644 --- a/api/members/members_models/user.go +++ b/api/members/members_models/user.go @@ -161,6 +161,9 @@ type User struct { // Profile ProfileID *string `json:"ProfileID,omitempty"` + // Login Provider + Provider *string `json:"Provider,omitempty"` + // Info Emails ReceivesAdminEmails *bool `json:"ReceivesAdminEmails,omitempty"` diff --git a/api/members/members_models/user_auth.go b/api/members/members_models/user_auth.go new file mode 100644 index 0000000..29ef874 --- /dev/null +++ b/api/members/members_models/user_auth.go @@ -0,0 +1,132 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// (c) 2012-2023 by Vernon Keenan +// All rights reserved worldwide. +// Proprietary product; unlicensed use is not allowed + +package members_models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// UserAuth user auth +// +// swagger:model UserAuth +type UserAuth struct { + + // Access Token + AccessToken *string `json:"accessToken,omitempty"` + + // Account ID + AccountID *string `json:"accountId,omitempty"` + + // API Key + APIKey *string `json:"apiKey,omitempty"` + + // Company Name + CompanyName *string `json:"companyName,omitempty"` + + // Contact + ContactID *string `json:"contactId,omitempty"` + + // Email address + Email string `json:"email,omitempty"` + + // Environment + Environment *string `json:"environment,omitempty"` + + // The first name + FirstName *string `json:"firstName,omitempty"` + + // GitHub + GitHub *string `json:"gitHub,omitempty"` + + // Record ID + ID string `json:"id,omitempty"` + + // Photo URL + Image *string `json:"image,omitempty"` + + // Active + IsActive *bool `json:"isActive,omitempty"` + + // IP address of last login + LastIP *string `json:"lastIp,omitempty"` + + // Last login time + LastLogin *string `json:"lastLogin,omitempty"` + + // The Last Name + LastName *string `json:"lastName,omitempty"` + + // LinkedIn + LinkedIn *string `json:"linkedIn,omitempty"` + + // Number of times user has logged in + LoginCount *int64 `json:"loginCount,omitempty"` + + // Mobile + MobilePhone *string `json:"mobilePhone,omitempty"` + + // Name + Name *string `json:"name,omitempty"` + + // Password + Password *string `json:"password,omitempty"` + + // Phone + Phone *string `json:"phone,omitempty"` + + // Portal Role Level + PortalRole *string `json:"portalRole,omitempty"` + + // Provider + Provider *string `json:"provider,omitempty"` + + // Onboarding Status + Status *string `json:"status,omitempty"` + + // Tenant ID associated with this user + TenantID *string `json:"tenantId,omitempty"` + + // Title + Title *string `json:"title,omitempty"` + + // Twitter + Twitter *string `json:"twitter,omitempty"` +} + +// Validate validates this user auth +func (m *UserAuth) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this user auth based on context it is used +func (m *UserAuth) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UserAuth) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserAuth) UnmarshalBinary(b []byte) error { + var res UserAuth + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/members/members_models/webhook_clerk_request.go b/api/members/members_models/webhook_clerk_request.go deleted file mode 100644 index 8492a9a..0000000 --- a/api/members/members_models/webhook_clerk_request.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// (c) 2012-2023 by Vernon Keenan -// All rights reserved worldwide. -// Proprietary product; unlicensed use is not allowed - -package members_models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// WebhookClerkRequest Clerk webhook object -// -// swagger:model WebhookClerkRequest -type WebhookClerkRequest struct { - - // data - Data interface{} `json:"data,omitempty"` - - // object - Object string `json:"object,omitempty"` - - // Clerk Name - Type string `json:"type,omitempty"` -} - -// Validate validates this webhook clerk request -func (m *WebhookClerkRequest) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this webhook clerk request based on context it is used -func (m *WebhookClerkRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *WebhookClerkRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *WebhookClerkRequest) UnmarshalBinary(b []byte) error { - var res WebhookClerkRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/api/members/members_models/webhook_clerk_response.go b/api/members/members_models/webhook_clerk_response.go deleted file mode 100644 index 4854b76..0000000 --- a/api/members/members_models/webhook_clerk_response.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// (c) 2012-2023 by Vernon Keenan -// All rights reserved worldwide. -// Proprietary product; unlicensed use is not allowed - -package members_models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// WebhookClerkResponse Clerk webhook object -// -// swagger:model WebhookClerkResponse -type WebhookClerkResponse struct { - - // data - Data interface{} `json:"data,omitempty"` - - // object - Object *string `json:"object,omitempty"` - - // Clerk Name - Type *string `json:"type,omitempty"` -} - -// Validate validates this webhook clerk response -func (m *WebhookClerkResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this webhook clerk response based on context it is used -func (m *WebhookClerkResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *WebhookClerkResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *WebhookClerkResponse) UnmarshalBinary(b []byte) error { - var res WebhookClerkResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/app/user-helpers.go b/app/user-helpers.go index d97884a..4bf8b4b 100644 --- a/app/user-helpers.go +++ b/app/user-helpers.go @@ -55,6 +55,7 @@ func MarshalAuthUserToSwagger(obj *auth_models.User) *User { EndOfDay: obj.EndOfDay, Environment: obj.Environment, Extension: obj.Extension, + ExternalAccount: obj.ExternalAccount, FabricAPIKey: obj.FabricAPIKey, Fax: obj.Fax, FirstName: obj.FirstName, @@ -78,6 +79,7 @@ func MarshalAuthUserToSwagger(obj *auth_models.User) *User { Phone: obj.Phone, PortalRole: obj.PortalRole, ProfileID: obj.ProfileID, + Provider: obj.Provider, ReceivesAdminEmails: obj.ReceivesAdminEmails, ReceivesAdminInfoEmails: obj.ReceivesAdminInfoEmails, SenderEmail: obj.SenderEmail, @@ -85,7 +87,6 @@ func MarshalAuthUserToSwagger(obj *auth_models.User) *User { Signature: obj.Signature, SmallPhotoURL: obj.SmallPhotoURL, StartOfDay: obj.StartOfDay, - ExternalAccount: obj.ExternalAccount, TenantID: obj.TenantID, TenantUsers: tenantUsers, TimeZone: obj.TimeZone, diff --git a/app/user.go b/app/user.go index f2d1708..a3b2293 100644 --- a/app/user.go +++ b/app/user.go @@ -57,6 +57,7 @@ type User struct { Phone string PortalRole string ProfileID string + Provider string ReceivesAdminEmails bool ReceivesAdminInfoEmails bool ReceivesInfoEmails bool diff --git a/swagger/auth-work.yaml b/swagger/auth-work.yaml index 5439156..4cc61b3 100644 --- a/swagger/auth-work.yaml +++ b/swagger/auth-work.yaml @@ -278,6 +278,9 @@ definitions: ProfileID: description: Profile type: string + Provider: + description: Provider + type: string ReceivesAdminInfoEmails: description: Admin Info Emails type: boolean diff --git a/swagger/crm-work.yaml b/swagger/crm-work.yaml index d225aba..801fd87 100644 --- a/swagger/crm-work.yaml +++ b/swagger/crm-work.yaml @@ -3,7 +3,7 @@ info: version: 0.3.4 title: "crm" description: "Customer Information Microservice" - termsOfService: "https://salesforcedevops.net/terms/" + termsOfService: "https://WorkDifferentWithAI.com/terms/" contact: email: "vern@vernonkeenan.com" license: @@ -242,7 +242,7 @@ responses: paths: /accounts: delete: - description: Delete SalesforceDevops.net Account record + description: Delete WorkDifferentWithAI.com Account record operationId: deleteAccount parameters: - $ref: "#/parameters/accountIdQuery" @@ -312,7 +312,7 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] - summary: Add a new account to SalesforceDevops.net + summary: Add a new account to WorkDifferentWithAI.com tags: - Accounts put: @@ -340,7 +340,7 @@ paths: - Accounts /assets: delete: - description: Delete SalesforceDevops.net Asset record + description: Delete WorkDifferentWithAI.com Asset record operationId: deleteAsset parameters: - $ref: "#/parameters/assetIdQuery" @@ -408,7 +408,7 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] - summary: Add a new asset to SalesforceDevops.net + summary: Add a new asset to WorkDifferentWithAI.com tags: - Assets put: @@ -436,7 +436,7 @@ paths: - Assets /contracts: delete: - description: Delete SalesforceDevops.net Contract record + description: Delete WorkDifferentWithAI.com Contract record operationId: deleteContract parameters: - $ref: "#/parameters/contractIdQuery" @@ -504,7 +504,7 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] - summary: Add a new contract to SalesforceDevops.net + summary: Add a new contract to WorkDifferentWithAI.com tags: - Contracts put: @@ -532,7 +532,7 @@ paths: - Contracts /contacts: delete: - description: Delete SalesforceDevops.net Contact record + description: Delete WorkDifferentWithAI.com Contact record operationId: deleteContact parameters: - $ref: "#/parameters/contactIdQuery" @@ -630,7 +630,7 @@ paths: - Contacts /leads: delete: - description: Delete SalesforceDevops.net Lead record + description: Delete WorkDifferentWithAI.com Lead record operationId: deleteLead parameters: - $ref: "#/parameters/leadIdQuery" diff --git a/swagger/defs/user.yaml b/swagger/defs/user.yaml index 76387fc..1f1e288 100644 --- a/swagger/defs/user.yaml +++ b/swagger/defs/user.yaml @@ -178,6 +178,10 @@ User: description: Profile type: string x-nullable: true + Provider: + description: Login Provider + type: string + x-nullable: true ReceivesAdminEmails: description: Info Emails type: boolean diff --git a/swagger/external/auth-work.yaml b/swagger/external/auth-work.yaml index 369439f..363334d 100644 --- a/swagger/external/auth-work.yaml +++ b/swagger/external/auth-work.yaml @@ -278,6 +278,9 @@ definitions: ProfileID: description: Profile type: string + Provider: + description: Provider + type: string ReceivesAdminInfoEmails: description: Admin Info Emails type: boolean diff --git a/swagger/external/crm-work.yaml b/swagger/external/crm-work.yaml index 997cdad..8c26ff1 100644 --- a/swagger/external/crm-work.yaml +++ b/swagger/external/crm-work.yaml @@ -3,7 +3,7 @@ info: version: 0.3.4 title: "crm" description: "Customer Information Microservice" - termsOfService: "https://salesforcedevops.net/terms/" + termsOfService: "https://WorkDifferentWithAI.com/terms/" contact: email: "vern@vernonkeenan.com" license: @@ -242,7 +242,7 @@ responses: paths: /accounts: delete: - description: Delete SalesforceDevops.net Account record + description: Delete WorkDifferentWithAI.com Account record operationId: deleteAccount parameters: - $ref: "#/parameters/accountIdQuery" @@ -312,7 +312,7 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] - summary: Add a new account to SalesforceDevops.net + summary: Add a new account to WorkDifferentWithAI.com tags: - Accounts put: @@ -340,7 +340,7 @@ paths: - Accounts /assets: delete: - description: Delete SalesforceDevops.net Asset record + description: Delete WorkDifferentWithAI.com Asset record operationId: deleteAsset parameters: - $ref: "#/parameters/assetIdQuery" @@ -408,7 +408,7 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] - summary: Add a new asset to SalesforceDevops.net + summary: Add a new asset to WorkDifferentWithAI.com tags: - Assets put: @@ -436,7 +436,7 @@ paths: - Assets /contracts: delete: - description: Delete SalesforceDevops.net Contract record + description: Delete WorkDifferentWithAI.com Contract record operationId: deleteContract parameters: - $ref: "#/parameters/contractIdQuery" @@ -504,7 +504,7 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] - summary: Add a new contract to SalesforceDevops.net + summary: Add a new contract to WorkDifferentWithAI.com tags: - Contracts put: @@ -532,7 +532,7 @@ paths: - Contracts /contacts: delete: - description: Delete SalesforceDevops.net Contact record + description: Delete WorkDifferentWithAI.com Contact record operationId: deleteContact parameters: - $ref: "#/parameters/contactIdQuery" @@ -630,7 +630,7 @@ paths: - Contacts /leads: delete: - description: Delete SalesforceDevops.net Lead record + description: Delete WorkDifferentWithAI.com Lead record operationId: deleteLead parameters: - $ref: "#/parameters/leadIdQuery" diff --git a/swagger/external/members-work.yaml b/swagger/external/members-work.yaml index 70a431b..36dc943 100644 --- a/swagger/external/members-work.yaml +++ b/swagger/external/members-work.yaml @@ -291,13 +291,13 @@ parameters: required: true schema: $ref: "#/definitions/UserRequest" - WebhookClerkRequest: - description: An array of new WebhookClerk records + UserAuthRequest: + description: A simple user authentication request in: body - name: webhookclerkRequest + name: UserAuthRequest required: true schema: - $ref: "#/definitions/WebhookClerkRequest" + $ref: "#/definitions/UserAuth" activeQuery: description: Retrieve active records only? in: query @@ -566,10 +566,10 @@ responses: description: Response with User objects schema: $ref: "#/definitions/UserResponse" - WebhookClerkResponse: - description: WebhookClerk Response Object + UserAuthResponse: + description: Response with single UserAuth object schema: - $ref: "#/definitions/WebhookClerkResponse" + $ref: "#/definitions/UserAuth" paths: /attendees: get: @@ -3130,6 +3130,50 @@ paths: summary: Update Transaction tags: - Transactions + /users/auth: + post: + description: Authenticate a user + operationId: postUsersAuth + parameters: + - $ref: "#/parameters/UserAuthRequest" + responses: + "200": + $ref: "#/responses/UserAuthResponse" + "401": + $ref: "#/responses/Unauthorized" + "404": + $ref: "#/responses/NotFound" + "422": + $ref: "#/responses/UnprocessableEntity" + "500": + $ref: "#/responses/ServerError" + summary: Authenticate a user + tags: + - Users + security: + - ApiKeyAuth: [] + /users/auth/password: + post: + description: Change user password + operationId: postUsersAuthPassword + parameters: + - $ref: "#/parameters/UserAuthRequest" + responses: + "200": + $ref: "#/responses/UserAuthResponse" + "401": + $ref: "#/responses/Unauthorized" + "404": + $ref: "#/responses/NotFound" + "422": + $ref: "#/responses/UnprocessableEntity" + "500": + $ref: "#/responses/ServerError" + summary: Change user password + tags: + - Users + security: + - ApiKeyAuth: [] /users/onboard: post: description: Async onboard new users @@ -3986,223 +4030,113 @@ definitions: Meta: $ref: "#/definitions/ResponseMeta" type: object - WebhookClerkRequest: - description: Clerk webhook object + UserAuth: properties: - object: - type: string - type: - description: Clerk Name - type: string - data: - type: object - type: object - ClerkUser: - description: Clerk user object - type: object - properties: - external_id: + accountId: + description: Account ID type: string x-nullable: true - description: |- - The ID of the user as used in your external systems or your previous authentication solution. - Must be unique across your instance. - first_name: + accessToken: + description: Access Token type: string x-nullable: true - description: The first name to assign to the user - last_name: + apiKey: + description: API Key type: string x-nullable: true - description: The last name to assign to the user - email_address: - type: array - items: - type: string - x-nullable: true - description: |- - Email addresses to add to the user. - Must be unique across your instance. - The first email address will be set as the user's primary email address. - phone_number: - type: array - items: - type: string - x-nullable: true - description: |- - Phone numbers to add to the user. - Must be unique across your instance. - The first phone number will be set as the user's primary phone number. - web3_wallet: - type: array - items: - type: string - x-nullable: true - description: |- - Web3 wallets to add to the user. - Must be unique across your instance. - The first wallet will be set as the user's primary wallet. - username: + companyName: + description: Company Name + type: string + x-nullable: true + contactId: + description: Contact + type: string + x-nullable: true + email: + description: Email address + type: string + environment: + description: Environment + type: string + x-nullable: true + firstName: + description: The first name + type: string + x-nullable: true + image: + description: Photo URL + type: string + x-nullable: true + gitHub: + description: GitHub + type: string + x-nullable: true + id: + description: Record ID + type: string + isActive: + description: Active + type: boolean + x-nullable: true + lastIp: + description: IP address of last login + type: string + x-nullable: true + lastLogin: + description: Last login time + type: string + x-nullable: true + lastName: + description: The Last Name + type: string + x-nullable: true + linkedIn: + description: LinkedIn + type: string + x-nullable: true + loginCount: + description: Number of times user has logged in + format: int64 + type: number + x-nullable: true + mobilePhone: + description: Mobile + type: string + x-nullable: true + name: + description: Name type: string x-nullable: true - description: |- - The username to give to the user. - It must be unique across your instance. password: + description: Password type: string x-nullable: true - description: |- - The plaintext password to give the user. - Must be at least 8 characters long, and can not be in any list of hacked passwords. - password_digest: + phone: + description: Phone type: string x-nullable: true - description: |- - In case you already have the password digests and not the passwords, you can use them for the newly created user via this property. - The digests should be generated with one of the supported algorithms. - The hashing algorithm can be specified using the `password_hasher` property. - password_hasher: + portalRole: + description: Portal Role Level type: string x-nullable: true - description: |- - The hashing algorithm that was used to generate the password digest. - The algorithms we support at the moment are [bcrypt](https://en.wikipedia.org/wiki/Bcrypt), md5, pbkdf2_sha256, [pbkdf2_sha256_django](https://docs.djangoproject.com/en/4.0/topics/auth/passwords/), [scrypt_firebase](https://firebaseopensource.com/projects/firebase/scrypt/) and 2 [argon2](https://argon2.online/) variants, argon2i and argon2id. - Each of the above expects the incoming digest to be of a particular format. - - More specifically: - - **bcrypt:** The digest should be of the following form: - - `$$$` - - **md5:** The digest should follow the regular form e.g.: - - `5f4dcc3b5aa765d61d8327deb882cf99` - - **pbkdf2_sha256:** This is the PBKDF2 algorithm using the SHA256 hashing function. The format should be as follows: - - `pbkdf2_sha256$$$` - - Note: Both the salt and the hash are expected to be base64-encoded. - - **pbkdf2_sha256_django:** This is the Django-specific variant of PBKDF2 and the digest should have the following format (as exported from Django): - - `pbkdf2_sha256$$$` - - Note: The salt is expected to be un-encoded, the hash is expected base64-encoded. - - **pbkdf2_sha1:** This is similar to pkbdf2_sha256_django, but with two differences: - 1. uses sha1 instead of sha256 - 2. accepts the hash as a hex-encoded string - - The format is the following: - - `pbkdf2_sha1$$$` - - - **scrypt_firebase:** The Firebase-specific variant of scrypt. - The value is expected to have 6 segments separated by the $ character and include the following information: - - _hash:_ The actual Base64 hash. This can be retrieved when exporting the user from Firebase. - _salt:_ The salt used to generate the above hash. Again, this is given when exporting the user. - _signer key:_ The base64 encoded signer key. - _salt separator:_ The base64 encoded salt separator. - _rounds:_ The number of rounds the algorithm needs to run. - _memory cost:_ The cost of the algorithm run - - The first 2 (hash and salt) are per user and can be retrieved when exporting the user from Firebase. - The other 4 values (signer key, salt separator, rounds and memory cost) are project-wide settings and can be retrieved from the project's password hash parameters. - - Once you have all these, you can combine it in the following format and send this as the digest in order for Clerk to accept it: - - `$$$$$` - - **argon2i:** Algorithms in the argon2 family generate digests that encode the following information: - - _version (v):_ The argon version, version 19 is assumed - _memory (m):_ The memory used by the algorithm (in kibibytes) - _iterations (t):_ The number of iterations to perform - _parallelism (p):_ The number of threads to use - - Parts are demarcated by the `$` character, with the first part identifying the algorithm variant. - The middle part is a comma-separated list of the encoding options (memory, iterations, parallelism). - The final part is the actual digest. - - `$argon2i$v=19$m=4096,t=3,p=1$4t6CL3P7YiHBtwESXawI8Hm20zJj4cs7/4/G3c187e0$m7RQFczcKr5bIR0IIxbpO2P0tyrLjf3eUW3M3QSwnLc` - - **argon2id:** See the previous algorithm for an explanation of the formatting. - - For the argon2id case, the value of the algorithm in the first part of the digest is `argon2id`: - - `$argon2id$v=19$m=64,t=4,p=8$Z2liZXJyaXNo$iGXEpMBTDYQ8G/71tF0qGjxRHEmR3gpGULcE93zUJVU` - - If you need support for any particular hashing algorithm, [please let us know](https://clerk.com/support). - enum: - - bcrypt - - md5 - - pbkdf2_sha256 - - pbkdf2_sha256_django - - pbkdf2_sha1 - - scrypt_firebase - - argon2i - - argon2id - skip_password_checks: - type: boolean - description: |- - When set to `true` all password checks are skipped. - It is recommended to use this method only when migrating plaintext passwords to Clerk. - Upon migration the user base should be prompted to pick stronger password. - skip_password_requirement: - type: boolean - description: |- - When set to `true`, `password` is not required anymore when creating the user and can be omitted. - This is useful when you are trying to create a user that doesn't have a password, in an instance that is using passwords. - Please note that you cannot use this flag if password is the only way for a user to sign into your instance. - totp_secret: + provider: + description: Provider type: string x-nullable: true - description: |- - In case TOTP is configured on the instance, you can provide the secret to enable it on the newly created user without the need to reset it. - Please note that currently the supported options are: - * Period: 30 seconds - * Code length: 6 digits - * Algorithm: SHA1 - backup_codes: - type: array - items: - type: string - x-nullable: true - description: |- - If Backup Codes are configured on the instance, you can provide them to enable it on the newly created user without the need to reset them. - You must provide the backup codes in plain format or the corresponding bcrypt digest. - public_metadata: - type: object - description: Metadata saved on the user, that is visible to both - your Frontend and Backend APIs - private_metadata: - type: object - description: Metadata saved on the user, that is only visible to - your Backend API - unsafe_metadata: - type: object - description: |- - Metadata saved on the user, that can be updated from both the Frontend and Backend APIs. - Note: Since this data can be modified from the frontend, it is not guaranteed to be safe. - created_at: + status: + description: Onboarding Status type: string x-nullable: true - description: A custom date/time denoting _when_ the user signed - up to the application, specified in RFC3339 format (e.g. `2012-10-20T07:15:20.902Z`). - WebhookClerkResponse: - description: Clerk webhook object - properties: - object: + tenantId: + description: Tenant ID associated with this user type: string x-nullable: true - type: - description: Clerk Name + title: + description: Title + type: string + x-nullable: true + twitter: + description: Twitter type: string x-nullable: true - data: - type: object type: object diff --git a/swagger/members-work.yaml b/swagger/members-work.yaml index 7b8ffec..6056ec8 100644 --- a/swagger/members-work.yaml +++ b/swagger/members-work.yaml @@ -291,13 +291,13 @@ parameters: required: true schema: $ref: "#/definitions/UserRequest" - WebhookClerkRequest: - description: An array of new WebhookClerk records + UserAuthRequest: + description: A simple user authentication request in: body - name: webhookclerkRequest + name: UserAuthRequest required: true schema: - $ref: "#/definitions/WebhookClerkRequest" + $ref: "#/definitions/UserAuth" activeQuery: description: Retrieve active records only? in: query @@ -566,10 +566,10 @@ responses: description: Response with User objects schema: $ref: "#/definitions/UserResponse" - WebhookClerkResponse: - description: WebhookClerk Response Object + UserAuthResponse: + description: Response with single UserAuth object schema: - $ref: "#/definitions/WebhookClerkResponse" + $ref: "#/definitions/UserAuth" paths: /attendees: get: @@ -3130,6 +3130,50 @@ paths: summary: Update Transaction tags: - Transactions + /users/auth: + post: + description: Authenticate a user + operationId: postUsersAuth + parameters: + - $ref: "#/parameters/UserAuthRequest" + responses: + "200": + $ref: "#/responses/UserAuthResponse" + "401": + $ref: "#/responses/Unauthorized" + "404": + $ref: "#/responses/NotFound" + "422": + $ref: "#/responses/UnprocessableEntity" + "500": + $ref: "#/responses/ServerError" + summary: Authenticate a user + tags: + - Users + security: + - ApiKeyAuth: [] + /users/auth/password: + post: + description: Change user password + operationId: postUsersAuthPassword + parameters: + - $ref: "#/parameters/UserAuthRequest" + responses: + "200": + $ref: "#/responses/UserAuthResponse" + "401": + $ref: "#/responses/Unauthorized" + "404": + $ref: "#/responses/NotFound" + "422": + $ref: "#/responses/UnprocessableEntity" + "500": + $ref: "#/responses/ServerError" + summary: Change user password + tags: + - Users + security: + - ApiKeyAuth: [] /users/onboard: post: description: Async onboard new users @@ -3986,223 +4030,113 @@ definitions: Meta: $ref: "#/definitions/ResponseMeta" type: object - WebhookClerkRequest: - description: Clerk webhook object + UserAuth: properties: - object: - type: string - type: - description: Clerk Name - type: string - data: - type: object - type: object - ClerkUser: - description: Clerk user object - type: object - properties: - external_id: + accountId: + description: Account ID type: string x-nullable: true - description: |- - The ID of the user as used in your external systems or your previous authentication solution. - Must be unique across your instance. - first_name: + accessToken: + description: Access Token type: string x-nullable: true - description: The first name to assign to the user - last_name: + apiKey: + description: API Key type: string x-nullable: true - description: The last name to assign to the user - email_address: - type: array - items: - type: string - x-nullable: true - description: |- - Email addresses to add to the user. - Must be unique across your instance. - The first email address will be set as the user's primary email address. - phone_number: - type: array - items: - type: string - x-nullable: true - description: |- - Phone numbers to add to the user. - Must be unique across your instance. - The first phone number will be set as the user's primary phone number. - web3_wallet: - type: array - items: - type: string - x-nullable: true - description: |- - Web3 wallets to add to the user. - Must be unique across your instance. - The first wallet will be set as the user's primary wallet. - username: + companyName: + description: Company Name + type: string + x-nullable: true + contactId: + description: Contact + type: string + x-nullable: true + email: + description: Email address + type: string + environment: + description: Environment + type: string + x-nullable: true + firstName: + description: The first name + type: string + x-nullable: true + image: + description: Photo URL + type: string + x-nullable: true + gitHub: + description: GitHub + type: string + x-nullable: true + id: + description: Record ID + type: string + isActive: + description: Active + type: boolean + x-nullable: true + lastIp: + description: IP address of last login + type: string + x-nullable: true + lastLogin: + description: Last login time + type: string + x-nullable: true + lastName: + description: The Last Name + type: string + x-nullable: true + linkedIn: + description: LinkedIn + type: string + x-nullable: true + loginCount: + description: Number of times user has logged in + format: int64 + type: number + x-nullable: true + mobilePhone: + description: Mobile + type: string + x-nullable: true + name: + description: Name type: string x-nullable: true - description: |- - The username to give to the user. - It must be unique across your instance. password: + description: Password type: string x-nullable: true - description: |- - The plaintext password to give the user. - Must be at least 8 characters long, and can not be in any list of hacked passwords. - password_digest: + phone: + description: Phone type: string x-nullable: true - description: |- - In case you already have the password digests and not the passwords, you can use them for the newly created user via this property. - The digests should be generated with one of the supported algorithms. - The hashing algorithm can be specified using the `password_hasher` property. - password_hasher: + portalRole: + description: Portal Role Level type: string x-nullable: true - description: |- - The hashing algorithm that was used to generate the password digest. - The algorithms we support at the moment are [bcrypt](https://en.wikipedia.org/wiki/Bcrypt), md5, pbkdf2_sha256, [pbkdf2_sha256_django](https://docs.djangoproject.com/en/4.0/topics/auth/passwords/), [scrypt_firebase](https://firebaseopensource.com/projects/firebase/scrypt/) and 2 [argon2](https://argon2.online/) variants, argon2i and argon2id. - Each of the above expects the incoming digest to be of a particular format. - - More specifically: - - **bcrypt:** The digest should be of the following form: - - `$$$` - - **md5:** The digest should follow the regular form e.g.: - - `5f4dcc3b5aa765d61d8327deb882cf99` - - **pbkdf2_sha256:** This is the PBKDF2 algorithm using the SHA256 hashing function. The format should be as follows: - - `pbkdf2_sha256$$$` - - Note: Both the salt and the hash are expected to be base64-encoded. - - **pbkdf2_sha256_django:** This is the Django-specific variant of PBKDF2 and the digest should have the following format (as exported from Django): - - `pbkdf2_sha256$$$` - - Note: The salt is expected to be un-encoded, the hash is expected base64-encoded. - - **pbkdf2_sha1:** This is similar to pkbdf2_sha256_django, but with two differences: - 1. uses sha1 instead of sha256 - 2. accepts the hash as a hex-encoded string - - The format is the following: - - `pbkdf2_sha1$$$` - - - **scrypt_firebase:** The Firebase-specific variant of scrypt. - The value is expected to have 6 segments separated by the $ character and include the following information: - - _hash:_ The actual Base64 hash. This can be retrieved when exporting the user from Firebase. - _salt:_ The salt used to generate the above hash. Again, this is given when exporting the user. - _signer key:_ The base64 encoded signer key. - _salt separator:_ The base64 encoded salt separator. - _rounds:_ The number of rounds the algorithm needs to run. - _memory cost:_ The cost of the algorithm run - - The first 2 (hash and salt) are per user and can be retrieved when exporting the user from Firebase. - The other 4 values (signer key, salt separator, rounds and memory cost) are project-wide settings and can be retrieved from the project's password hash parameters. - - Once you have all these, you can combine it in the following format and send this as the digest in order for Clerk to accept it: - - `$$$$$` - - **argon2i:** Algorithms in the argon2 family generate digests that encode the following information: - - _version (v):_ The argon version, version 19 is assumed - _memory (m):_ The memory used by the algorithm (in kibibytes) - _iterations (t):_ The number of iterations to perform - _parallelism (p):_ The number of threads to use - - Parts are demarcated by the `$` character, with the first part identifying the algorithm variant. - The middle part is a comma-separated list of the encoding options (memory, iterations, parallelism). - The final part is the actual digest. - - `$argon2i$v=19$m=4096,t=3,p=1$4t6CL3P7YiHBtwESXawI8Hm20zJj4cs7/4/G3c187e0$m7RQFczcKr5bIR0IIxbpO2P0tyrLjf3eUW3M3QSwnLc` - - **argon2id:** See the previous algorithm for an explanation of the formatting. - - For the argon2id case, the value of the algorithm in the first part of the digest is `argon2id`: - - `$argon2id$v=19$m=64,t=4,p=8$Z2liZXJyaXNo$iGXEpMBTDYQ8G/71tF0qGjxRHEmR3gpGULcE93zUJVU` - - If you need support for any particular hashing algorithm, [please let us know](https://clerk.com/support). - enum: - - bcrypt - - md5 - - pbkdf2_sha256 - - pbkdf2_sha256_django - - pbkdf2_sha1 - - scrypt_firebase - - argon2i - - argon2id - skip_password_checks: - type: boolean - description: |- - When set to `true` all password checks are skipped. - It is recommended to use this method only when migrating plaintext passwords to Clerk. - Upon migration the user base should be prompted to pick stronger password. - skip_password_requirement: - type: boolean - description: |- - When set to `true`, `password` is not required anymore when creating the user and can be omitted. - This is useful when you are trying to create a user that doesn't have a password, in an instance that is using passwords. - Please note that you cannot use this flag if password is the only way for a user to sign into your instance. - totp_secret: + provider: + description: Provider type: string x-nullable: true - description: |- - In case TOTP is configured on the instance, you can provide the secret to enable it on the newly created user without the need to reset it. - Please note that currently the supported options are: - * Period: 30 seconds - * Code length: 6 digits - * Algorithm: SHA1 - backup_codes: - type: array - items: - type: string - x-nullable: true - description: |- - If Backup Codes are configured on the instance, you can provide them to enable it on the newly created user without the need to reset them. - You must provide the backup codes in plain format or the corresponding bcrypt digest. - public_metadata: - type: object - description: Metadata saved on the user, that is visible to both - your Frontend and Backend APIs - private_metadata: - type: object - description: Metadata saved on the user, that is only visible to - your Backend API - unsafe_metadata: - type: object - description: |- - Metadata saved on the user, that can be updated from both the Frontend and Backend APIs. - Note: Since this data can be modified from the frontend, it is not guaranteed to be safe. - created_at: + status: + description: Onboarding Status type: string x-nullable: true - description: A custom date/time denoting _when_ the user signed - up to the application, specified in RFC3339 format (e.g. `2012-10-20T07:15:20.902Z`). - WebhookClerkResponse: - description: Clerk webhook object - properties: - object: + tenantId: + description: Tenant ID associated with this user type: string x-nullable: true - type: - description: Clerk Name + title: + description: Title + type: string + x-nullable: true + twitter: + description: Twitter type: string x-nullable: true - data: - type: object type: object