Exemplo n.º 1
0
 public static Guid RegisterEndpoint(this RestClient client, string monitor, string address, string group, string name, string[] tags = null, Credentials credentials = null, string monitorTag=null)
 {
     var request = new RestRequest(EndpointRegistrationUrl)
         .AddJsonBody(new {group, monitorType = monitor, name, address, tags, monitorTag});
     var response = client.Authorize(credentials).Post(request);
     response.VerifyValidStatus(HttpStatusCode.Created);
     return JsonConvert.DeserializeObject<Guid>(response.Content);
 }
 public static void Authorize(this IAuthorizationHelper authorizationHelper, IAbpAuthorizeAttribute authorizeAttribute)
 {
     authorizationHelper.Authorize(new[] { authorizeAttribute });
 }
Exemplo n.º 3
0
        public static void AuthenticateImap(this Imap4Client imap, MailBox account, ILogger log = null)
        {
            if (log == null)
                log = new NullLogger();

            if (account.RefreshToken != null)
            {
                var serviceType = (AuthorizationServiceType)account.ServiceType;

                switch (serviceType)
                {
                    case AuthorizationServiceType.Google:
                        imap.AuthenticateImapGoogleOAuth2(account, log);
                        return;
                }
            }

            imap.Authorize(new MailServerSettings
            {
                AccountName = account.Account,
                AccountPass = account.Password,
                AuthenticationType = account.AuthenticationTypeIn,
                EncryptionType = account.IncomingEncryptionType,
                Port = account.Port,
                Url = account.Server
            }, account.AuthorizeTimeoutInMilliseconds, log);

            log.Info("IMAP logged in to {0}", account.EMail);
        }