public override object Authorize (HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason)
		{
			string SessionId = Header.GetCookie ("SessionId");

			if (MainClass.CheckSession (SessionId, out UserName))
			{
				Reason = UnauthorizedReason.NoError;
				return UserName;
			} else
			{
				Reason = UnauthorizedReason.OldCredentialsTryAgain;
				return null;
			}
		}
예제 #2
0
		public AuthenticationException(UnauthorizedReason reason)
		{
			Reason = reason;
		}
        public override object Authorize(HttpHeader Header, HttpServer.Method Method, IHttpServerResource Resource, System.Net.EndPoint RemoteEndPoint, out string UserName, out UnauthorizedReason Reason)
        {
            string SessionId = Header.GetCookie("SessionId");

            if (MainClass.CheckSession(SessionId, out UserName))
            {
                Reason = UnauthorizedReason.NoError;
                return(UserName);
            }
            else
            {
                Reason = UnauthorizedReason.OldCredentialsTryAgain;
                return(null);
            }
        }
 public UnauthorizedException(UnauthorizedReason unauthorizedReason)
     : base($"Unauthorized access to method. Reason: '{unauthorizedReason.ToString()}'")
 {
     this.UnauthorizedReason = unauthorizedReason;
 }