public AuthParameters SetLogin(HttpRequestMessage request) { using (LogManager.OpenNestedContext("Login")) { try { string tenant = ConfigurationManager.AppSettings["Tenant"]; Login login = JsonConvert.DeserializeObject <Login>(request.Content.ReadAsStringAsync().Result); if (login != null) { IAuthInfo auth = SecurityHelper.RequestLogin(login.user, login.password, "en", tenant); AuthParameters result = new AuthParameters(); result.authinfo = auth; result.token = auth.Token.AccessToken; return(result); } return(null); } catch (Exception ex) { String messageError = String.Format(CultureInfo.InvariantCulture, "Exception in Login"); Log.ErrorException(messageError, ex); throw new QueryException(messageError, ex); } } }
/************************ Construction ***********************************/ /*----------------------- RemoteRepository ------------------------------*/ /// <summary> /// Constructor /// </summary> /// <param name="server"> /// The real server /// </param> /// <param name="owner"> /// Owner of the repository /// </param> /// <param name="name"> /// Name of the repository /// </param> /// <param name="auth"> /// Authentication associated with the remote repository /// </param> /// <param name="disableHTTPS"> /// Should secure be disabled /// </param> public RemoteRepository( string server, string owner, string name, IAuthInfo auth, bool disableHTTPS = false) { if (null == (Server = server)) { throw new ArgumentNullException(nameof(server), "Must provide a property server name"); } if (null == (Owner = owner)) { throw new ArgumentNullException(nameof(owner), "Must provide a valid owner name"); } if (null == (Name = name)) { throw new ArgumentNullException(nameof(name), "Must provide a valid name for the repository"); } else if (Name.EndsWith(".git")) { Name = Name.Remove(Name.LastIndexOf(".git")); } Auth = auth; string protocol = disableHTTPS ? "http" : "https"; Url = $"{protocol}://{Server}/{Owner}/{Name}"; GitUrl = auth == null ? Url : $"{protocol}://{auth.Decoded.ToString()}@{Server}/{Owner}/{Name}"; } /* End of Function - RemoteRepository */
private void OnClientLoggedIn(IAuthInfo authInfo) { device = new Device((IPEndPoint)socket.RemoteEndPoint, authInfo); if (authInfo.Type == ClientType.Device) { server.DeviceController.AddDevice(authInfo.Account.Id, device); } }
public Device(IPEndPoint deviceIP, IAuthInfo authInfo) : this(deviceIP, authInfo.Account, authInfo.Type) { }
public CategoryController(IMyBroideryContext context, IAuthInfo authInfo) { this.context = context; this.authInfo = authInfo; }
public ProductController(IMyBroideryContext context, IAuthInfo authInfo) { this.context = context; this.authInfo = authInfo; }
public AccountsController(IMyBroideryContext context, IAuthInfo authInfo) { this.context = context; this.authInfo = authInfo; }