コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        /************************ 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 */
コード例 #3
0
        private void OnClientLoggedIn(IAuthInfo authInfo)
        {
            device = new Device((IPEndPoint)socket.RemoteEndPoint, authInfo);

            if (authInfo.Type == ClientType.Device)
            {
                server.DeviceController.AddDevice(authInfo.Account.Id, device);
            }
        }
コード例 #4
0
ファイル: Device.cs プロジェクト: 10sa/IBLVM
 public Device(IPEndPoint deviceIP, IAuthInfo authInfo) : this(deviceIP, authInfo.Account, authInfo.Type)
 {
 }
コード例 #5
0
 public CategoryController(IMyBroideryContext context, IAuthInfo authInfo)
 {
     this.context  = context;
     this.authInfo = authInfo;
 }
コード例 #6
0
 public ProductController(IMyBroideryContext context, IAuthInfo authInfo)
 {
     this.context  = context;
     this.authInfo = authInfo;
 }
コード例 #7
0
 public AccountsController(IMyBroideryContext context, IAuthInfo authInfo)
 {
     this.context  = context;
     this.authInfo = authInfo;
 }