private AuthorizationCommands GetCommand(AuthorizationStatistic statistic, S scheme, AuthorizationError error)
        {
            switch (error)
            {
            case AuthorizationError.Success:
                return(AuthorizationCommands.None);

            case AuthorizationError.Continue:
                return((statistic.SuccessCount > 0)
                                                ? AuthorizationCommands.Cancel
                                                : AuthorizationCommands.Continue);

            case AuthorizationError.Failed:
                if (CanTryAgainWhenFail(scheme))
                {
                    if (statistic.SuccessCount == 0 && statistic.ContinueCount == 0)
                    {
                        return(AuthorizationCommands.TryAgain);
                    }
                }
                return(AuthorizationCommands.Cancel);

            case AuthorizationError.None:
                return((statistic.SuccessCount > 0 || statistic.ContinueCount > 0 || statistic.FailedCount > 0)
                                                ? AuthorizationCommands.None
                                                : AuthorizationCommands.TryAgain);

            default:
                throw new InvalidProgramException();
            }
        }
Beispiel #2
0
        public AuthorizationShedulerState(R reader, ArraySegment <byte> content, ByteArrayPart realm, int param)
        {
            Agent     = 0;
            Statistic = new AuthorizationStatistic();

            Reader  = reader;
            Content = content;
            Realm   = realm;
            Param   = param;
        }
Beispiel #3
0
 public AuthorizationShedulerResponse(AuthorizationCommands command, AuthorizationStatistic statistic, W writer)
 {
     Command   = command;
     Statistic = statistic;
     Writer    = writer;
 }
Beispiel #4
0
 public AuthorizationAgentsState(AuthorizationShedulerResponse <W> response)
 {
     Statistic = response.Statistic;
     Writer    = response.Writer;
 }