public IdentityCreateReply IdentityCreate(IdentityCreateRequest request) { try { IdentityCreateReply response = new IdentityCreateReply(); MembershipCreateStatus status = MembershipCreateStatus.ProviderError; MembershipUser user = request.User; user = _membership.CreateUser(user.UserName, request.Password, user.Email, user.PasswordQuestion, request.Answer, user.IsApproved, user.ProviderUserKey, out status); setStatus(response, status); response.User = user; response.CreateStatus = status; if (status == MembershipCreateStatus.Success && user != null) { user.IsApproved = false; user.Comment = Guid.NewGuid().ToString(); _membership.UpdateUser(user); response.ActivationKey = user.Comment; } return(response); } catch (Exception ex) { throw ex.NewFault(); } }
public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { using (_log.NewTrace()) { //WcfClientUtils.VerifyParameter("username", username); //WcfClientUtils.VerifyParameter("password", password); //WcfClientUtils.VerifyParameter("email", email); //WcfClientUtils.VerifyParameter("passwordQuestion", passwordQuestion); //WcfClientUtils.VerifyParameter("passwordAnswer", passwordAnswer); try { IdentityCreateRequest request = new IdentityCreateRequest(); request.ServiceSessionToken = WcfClientUtils.SessionToken; request.Answer = passwordAnswer; request.User = new MembershipUser("scrimpNetMembershipProvider", username, providerUserKey, email, passwordQuestion, "", isApproved, false, DateTime.UtcNow, Utils.Date.SqlMinDate, Utils.Date.SqlMinDate, DateTime.UtcNow, Utils.Date.SqlMinDate); request.Password = password; IdentityCreateReply response = _membershipService.IdentityCreate(request); status = response.CreateStatus; return(response.User); } catch (Exception ex) { throw WcfUtils.Extract(ex); } } }
public async Task <IActionResult> Create([FromBody] IdentityCreateRequest request) { try { if ((_identitySubsystem.IdentityServiceCapabilities & IdentityServiceCapabilities.Create) == 0) { return(NotImplemented()); } var result = await _identitySubsystem.Create(request); switch (result.StatusCode) { case IdentityStatusCode.Success: var route = Url.Link("IdentitiesGetById", new { id = result.Data }); return(Created(new Uri(route), result.Data)); case IdentityStatusCode.InvalidProperties: return(StatusCode((int)HttpStatusCode.BadRequest, result.Data)); case IdentityStatusCode.Incomplete: return(StatusCode((int)HttpStatusCode.BadGateway, InvalidServerResponse + "Incomplete")); case IdentityStatusCode.NotFound: return(NotFound(new NotFoundException())); default: return(StatusCode((int)HttpStatusCode.BadGateway, InvalidServerResponse + "Unknown")); } } catch (Exception ex) { return(StatusCode((int)HttpStatusCode.BadGateway, ex)); } }
public Task <IdentityResponseStatus <string> > Create(IdentityCreateRequest createRequest) { var id = string.Format("identity{0}", _identityIndex++); Identities.Add(id, createRequest); return(Task.FromResult( new IdentityResponseStatus <string> { Data = id, StatusCode = IdentityStatusCode.Success })); }
public async Task <HttpResponseMessage> Create([FromBody] IdentityCreateRequest request) { try { if ((_identitySubsystem.IdentityServiceCapabilities & IdentityServiceCapabilities.Create) == 0) { return(NotImplemented()); } var result = await _identitySubsystem.Create(request); switch (result.StatusCode) { case IdentityStatusCode.Success: var response = Request.CreateResponse(HttpStatusCode.Created); response.Content = new StringContent(result.Data, Encoding.UTF8, "application/text"); var route = Url.Link( "IdentitiesGetById", new { id = result.Data }); response.Headers.Location = new Uri(route); return(response); case IdentityStatusCode.InvalidProperties: return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, result.Data)); case IdentityStatusCode.Incomplete: return(Request.CreateErrorResponse(HttpStatusCode.BadGateway, InvalidServerResponse + "Incomplete")); case IdentityStatusCode.NotFound: return(Request.CreateErrorResponse(HttpStatusCode.NotFound, new NotFoundException())); default: return(Request.CreateErrorResponse(HttpStatusCode.BadGateway, InvalidServerResponse + "Unknown")); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadGateway, ex)); } }
/// <summary> /// Validates info provided and Creates a new MARSS Student Id based off ID provided the given Identity information. Assumption here is that the user has verified that possible matches are not correct matches. Returns error code or the MARSSID/StudentUniqueID with leading zeros removed. /// </summary> /// <param name="body">Identity object to be created.</param> /// <returns>A RestSharp <see cref="IRestResponse"/> instance containing the API response details.</returns> public IRestResponse IdentitiesV2_Create(IdentityCreateRequest body) { var request = new RestRequest("/v2/2019/identities", Method.POST); request.RequestFormat = DataFormat.Json; // verify required params are set if (body == null) { throw new ArgumentException("API method call is missing required parameters"); } request.AddBody(body); request.AddHeader("Accept", "application/json, text/json"); request.Parameters.First(param => param.Type == ParameterType.RequestBody).Name = "application/json, text/json"; var response = client.Execute(request); return(response); }
public Task <IdentityResponseStatus <string> > Create(IdentityCreateRequest createRequest) { throw new NotImplementedException(); }
/// <summary> /// Creates a new Unique Id for the given Identity information. Assumption here is that the user has verified that possible matches are not correct matches. Returns the created identity information along with the assigned Unique Id. /// </summary> /// <exception cref="EdFi.OdsApi.Sdk.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="request">Identity object to be created.</param> /// <returns>Task of ApiResponse (string)</returns> public async System.Threading.Tasks.Task <ApiResponse <string> > IdentitiesCreateAsyncWithHttpInfo(IdentityCreateRequest request) { // verify the required parameter 'request' is set if (request == null) { throw new ApiException(400, "Missing required parameter 'request' when calling IdentitiesApi->IdentitiesCreate"); } var localVarPath = "/2019/identities"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json", "text/json" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json", "text/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (request != null && request.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(request); // http body (model) parameter } else { localVarPostBody = request; // byte array } // authentication (oauth2_client_credentials) required // oauth required if (!String.IsNullOrEmpty(Configuration.AccessToken)) { localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("IdentitiesCreate", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <string>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (string)Configuration.ApiClient.Deserialize(localVarResponse, typeof(string)))); }
/// <summary> /// Creates a new Unique Id for the given Identity information. Assumption here is that the user has verified that possible matches are not correct matches. Returns the created identity information along with the assigned Unique Id. /// </summary> /// <exception cref="EdFi.OdsApi.Sdk.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="request">Identity object to be created.</param> /// <returns>Task of string</returns> public async System.Threading.Tasks.Task <string> IdentitiesCreateAsync(IdentityCreateRequest request) { ApiResponse <string> localVarResponse = await IdentitiesCreateAsyncWithHttpInfo(request); return(localVarResponse.Data); }
/// <summary> /// Creates a new Unique Id for the given Identity information. Assumption here is that the user has verified that possible matches are not correct matches. Returns the created identity information along with the assigned Unique Id. /// </summary> /// <exception cref="EdFi.OdsApi.Sdk.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="request">Identity object to be created.</param> /// <returns>string</returns> public string IdentitiesCreate(IdentityCreateRequest request) { ApiResponse <string> localVarResponse = IdentitiesCreateWithHttpInfo(request); return(localVarResponse.Data); }