• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AuthType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AuthType的典型用法代码示例。如果您正苦于以下问题:C# AuthType类的具体用法?C# AuthType怎么用?C# AuthType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AuthType类属于命名空间,在下文中一共展示了AuthType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RegisterUser

        public async Task<long> RegisterUser(string email, string password, string lastName, 
            string firstName, string middleName, AuthType? authType, string authId, bool confirmEmail)
        {
            var salt = password == null? null: PasswordHash.CreateSalt();
            var passwordHash = password == null ? null : PasswordHash.CreateHash(salt, password);

            var user = new User
            {
                AuthID = authId,
                AuthType = authType,
                Confirmed = authType.HasValue && !confirmEmail,
                DateJoined = DateTime.UtcNow,
                Deleted = false,
                Email = email,
                FirstName = firstName,
                LastName = lastName,
                MiddleName = middleName,
                Password = passwordHash,
                Salt = salt,
                Role = Role.Voter
            };

            user.Id = await userRepository.Add(user);

            if (!authType.HasValue || confirmEmail)
            {
                await SendConfirmationEmail(user);
            }
            return user.Id;
        }
开发者ID:mustee,项目名称:Voting,代码行数:30,代码来源:UserService.cs


示例2: LdapManager

        /// <summary>
        /// LDAP library constructior where all the class variables are initialized
        /// The variables not specified in definition will be set at default values.
        /// </summary>
        /// <param name="adminUser">Admin user</param>
        /// <param name="adminMode">Admin User</param>
        /// <param name="ldapServer">LDAP Server with port</param>
        /// <param name="ldapSearchBaseDn">Base DN where start the search.</param>
        /// <param name="authType"></param>
        /// <param name="loggerType">Mode to log</param>
        /// <param name="logPath">Path of the logger File</param>
        public LdapManager(ILdapUser adminUser, LDAPAdminMode adminMode,
            string ldapServer,
            string ldapSearchBaseDn,
            AuthType authType,
            LoggerType loggerType,
            string logPath
            )
        {
            _configRepository = LdapConfigRepositoryFactory.GetConfigRepository();
            try
            {
                _configRepository.BasicLdapConfig(adminUser,adminMode, ldapServer, ldapSearchBaseDn, authType, loggerType, logPath);
                _logger = LoggerFactory.GetLogger(_configRepository.GetWriteLogFlag(), _configRepository.GetLogPath());
            }
            catch (ArgumentNullException)
            {
                _ldapCurrentState = LdapState.LdapLibraryInitError;
                throw;
            }

            _adminModeChecker = new LdapAdminModeChecker(_configRepository);

            CommonInitOperations();
            _ldapCurrentState = LdapState.LdapLibraryInitSuccess;
        }
开发者ID:tu226,项目名称:LDAP-Library,代码行数:36,代码来源:LDAPManager.cs


示例3: CreateTokenCommand

 /// <summary>
 /// 构造函数
 /// </summary>
 public CreateTokenCommand(string clientId, AuthType authType)
 {
     Guard.IsNotNullOrEmpty(clientId, "clientId");
     this.ClientId = clientId;
     AuthType = authType;
     TimeOut = 3600;
 }
开发者ID:Cotide,项目名称:Cotide.DomainDrivenDesign,代码行数:10,代码来源:CreateTokenCommand.cs


示例4: PeerEventArgs

        /// <summary>
        /// PeerEventArgs Constructor
        /// </summary>
        /// <param name="parsed">a simple MessageParse</param>
        internal PeerEventArgs(dynamic parsed)
        {
#if DEBUG
            FCP2Protocol.ArgsDebug(this, parsed);
#endif

            LastGoodVersion = parsed.lastGoodVersion;
            Opennet = parsed.opennet;
            MyName = parsed.myName;
            Identity = parsed.identity;
            Location = parsed.location;
            Testnet = parsed.testnet;
            Version = parsed.version;
            Physical = new PhysicalType(parsed);
            Ark = new ArkType(parsed);
            DsaPubKey = new DsaPubKeyType(parsed);
            DsaGroup = new DsaGroupType(parsed);
            Auth = new AuthType(parsed);
            Volatile = new VolatileType(parsed);
            Metadata = new MetadataType(parsed);

#if DEBUG
            parsed.PrintAccessCount();
#endif
        }
开发者ID:FreeApophis,项目名称:fcp2lib.NET,代码行数:29,代码来源:PeerEventArgs.cs


示例5: AddServer

        public void AddServer(LdapDirectoryIdentifier identifier, int maxConnections, int protocolVersion = 3, bool ssl = false, double? timeout = null, NetworkCredential credentials = null, AuthType? authType = null)
        {
            var serverName = identifier.Servers[0];
            var factory = new LdapConnectionFactory(serverName);
            if (credentials != null)
                factory.AuthenticateAs(credentials);
            if (authType.HasValue)
                factory.AuthenticateBy(authType.Value);

            if (timeout.HasValue)
                factory.ConnectionTimeoutIn(timeout.Value);

            factory.ProtocolVersion(protocolVersion);

            if (identifier.FullyQualifiedDnsHostName)
                factory.ServerNameIsFullyQualified();

            if (identifier.Connectionless)
                factory.UseUdp();

            if (ssl) factory.UseSsl();

            factory.UsePort(identifier.PortNumber);

            _servers[serverName] = new ServerPoolMemberConnectionFactory(serverName, factory, maxConnections);
        }
开发者ID:madhatter22,项目名称:ServerPoolConnectionFactory,代码行数:26,代码来源:PooledServerConnectionFactory.cs


示例6: PeerEventArgs

        /// <summary>
        /// PeerEventArgs Constructor
        /// </summary>
        /// <param name="parsed">a simple MessageParse</param>
        internal PeerEventArgs(dynamic parsed)
        {
#if DEBUG
            FCP2Protocol.ArgsDebug(this, parsed);
#endif

            lastGoodVersion = parsed.lastGoodVersion;
            opennet = parsed.opennet;
            myName = parsed.myName;
            identity = parsed.identity;
            location = parsed.location;
            testnet = parsed.testnet;
            version = parsed.version;
            physical = new PhysicalType(parsed);
            ark = new ArkType(parsed);
            dsaPubKey = new DsaPubKeyType(parsed);
            dsaGroup = new DsaGroupType(parsed);
            auth = new AuthType(parsed);
            @volatile = new VolatileType(parsed);
            metadata = new MetadataType(parsed);

#if DEBUG
            parsed.PrintAccessCount();
#endif
        }
开发者ID:vincentmele,项目名称:fcp2lib.NET,代码行数:29,代码来源:PeerEventArgs.cs


示例7: GetInitialRequest

 public static Request GetInitialRequest(string authToken, AuthType authType, double lat, double lng, double altitude, params Request.Types.Requests[] customRequests)
 {
     return new Request()
     {
         Altitude = Utils.FloatAsUlong(altitude),
         Auth = new Request.Types.AuthInfo()
         {
             Provider = authType == AuthType.Google ? "google" : "ptc",
             Token = new Request.Types.AuthInfo.Types.JWT()
             {
                 Contents = authToken,
                 Unknown13 = 14
             }
         },
         Latitude = Utils.FloatAsUlong(lat),
         Longitude = Utils.FloatAsUlong(lng),
         RpcId = 1469378659230941192,
         Unknown1 = 2,
         Unknown12 = 989, //Required otherwise we receive incompatible protocol
         Requests =
         {
             customRequests
         }
     };
 }
开发者ID:CTCal,项目名称:GO-Bot,代码行数:25,代码来源:RequestBuilder.cs


示例8: SPClientContext

        public SPClientContext(Uri webFullUrl, AuthType authType = AuthType.Default, string userName = null,
            string password = null)
            : this(webFullUrl)
        {
            Authentication = authType;
            UserName = userName;

            switch (Authentication)
            {
                case AuthType.Default:
                    AuthenticationMode = ClientAuthenticationMode.Default;
                    Credentials = string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(password)
                        ? CredentialCache.DefaultNetworkCredentials
                        : new NetworkCredential(UserName, password);
                    break;

                case AuthType.SharePointOnline:
                    AuthenticationMode = ClientAuthenticationMode.Default;
                    Credentials = new SharePointOnlineCredentials(UserName, Utility.GetSecureString(password));
                    break;

                case AuthType.Anonymous:
                    AuthenticationMode = ClientAuthenticationMode.Anonymous;
                    break;

                case AuthType.Forms:
                    AuthenticationMode = ClientAuthenticationMode.FormsAuthentication;
                    FormsAuthenticationLoginInfo = new FormsAuthenticationLoginInfo(UserName, password);
                    break;
            }
        }
开发者ID:rlocus,项目名称:SPAccess,代码行数:31,代码来源:SPClientContext.cs


示例9: SessionManager

 public SessionManager(int appId, int perms)
 {
     this.sessions = new List<SessionInfo>();
     this.AppId = appId;
     this.Permissions = perms;
     this.AuthorizationType = AuthType.VKAuth;
 }
开发者ID:kholodovitch,项目名称:vk_winamp,代码行数:7,代码来源:SessionManager.cs


示例10: DoAuth

        public ActionResult DoAuth(AuthType authType)
        {
            var authHandler =
            AuthHandlerFactory.CreateAuthHandler(authType);

              // TODO: HI think of if ids are unique among differenct providers
              var userData =
            authHandler
              .ProcessAuthRequest(Request as HttpRequestWrapper);

              if (userData == null)
              {
            TempData["authError"] =
              "Authentication has failed.";

            return
              RedirectToAction("LogIn");
              }

              FormsAuthentication.SetAuthCookie(userData.UserName, true);

              return
            Session["ReturnUrl"] != null
            ? (ActionResult) Redirect((string) Session["ReturnUrl"])
            : RedirectToAction("Index", "Home");
        }
开发者ID:jperilla,项目名称:FreelanceHub,代码行数:26,代码来源:SimpleAuthController.cs


示例11: NodeDataEventArgs

        /// <summary>
        /// NodeDataEventArgs Constructor
        /// </summary>
        /// <param name="parsed">a simple MessageParse</param>
        internal NodeDataEventArgs(dynamic parsed)
        {
#if DEBUG
            FCP2Protocol.ArgsDebug(this, parsed);
#endif

            LastGoodVersion = parsed.lastGoodVersion;
            Sig = parsed.sig;
            Opennet = parsed.opennet;
            Identity = parsed.identity;
            Version = parsed.version;
            Physical = new PhysicalType(parsed.physical);
            Ark = new ArkType(parsed.ark);
            DsaPubKey = new DsaPubKeyType(parsed.dsaPubKey);
            DsaPrivKey = new DsaPrivKeyType(parsed.dsaPrivKey);
            DsaGroup = new DsaGroupType(parsed.dsaGroup);
            Auth = new AuthType(parsed.auth);

            ClientNonce = parsed.clientNonce;
            Location = parsed.location;
            if (!parsed.location.LastConversionSucessfull) { Location = -1.0; }

            if ([email protected]())
            {
                Volatile = new VolatileType([email protected]);
            }

#if DEBUG
            parsed.PrintAccessCount();
#endif
        }
开发者ID:FreeApophis,项目名称:fcp2lib.NET,代码行数:35,代码来源:NodeDataEventArgs.cs


示例12: GetUserNameAndPassword

        private bool GetUserNameAndPassword(HttpActionContext actionContext, out string username, out string password, out AuthType authType)
        {
            authType = AuthType.basic;
            bool gotIt = false;
            username = string.Empty;
            password = string.Empty;
            IEnumerable<string> headerVals;
            if (actionContext.Request.Headers.TryGetValues("Authorization", out headerVals))
            {
                try
                {
                    string authHeader = headerVals.FirstOrDefault();
                    char[] delims = { ' ' };
                    string[] authHeaderTokens = authHeader.Split(new char[] { ' ' });
                    if (authHeaderTokens[0].Contains("Basic"))
                    {
                        string decodedStr = DecodeFrom64(authHeaderTokens[1]);
                        string[] unpw = decodedStr.Split(new char[] { ':' });
                        username = unpw[0];
                        password = unpw[1];
                    }
                    else
                    {
                        if (authHeaderTokens.Length > 1)
                            username = DecodeFrom64(authHeaderTokens[1]);
                        authType = AuthType.cookie;
                    }

                    gotIt = true;
                }
                catch { gotIt = false; }
            }

            return gotIt;
        }
开发者ID:jpedromo,项目名称:ISP---Gestao-de-Matriculas,代码行数:35,代码来源:BasicAuthorizeAttribute.cs


示例13: AuthUser_EventArgs

		/// <summary>
		/// Default constructor.
		/// </summary>
		/// <param name="session">Reference to pop3 session.</param>
		/// <param name="userName">Username.</param>
		/// <param name="passwData">Password data.</param>
		/// <param name="data">Authentication specific data(as tag).</param>
		/// <param name="authType">Authentication type.</param>
		public AuthUser_EventArgs(SMTP_Session session,string userName,string passwData,string data,AuthType authType)
		{
			m_pSession  = session;
			m_UserName  = userName;
			m_PasswData = passwData;
			m_Data      = data;
			m_AuthType  = authType;
		}
开发者ID:vipwan,项目名称:CommunityServer,代码行数:16,代码来源:AuthUser_EventArgs.cs


示例14: GetConnectionForCore

        protected ConnectionHolder GetConnectionForCore(NetworkCredential credential, AuthType authType = AuthType.Basic)
        {
            connectionFactoryConfiguration
                .AuthenticateBy(authType)
                .AuthenticateAs(credential);

            return new ConnectionHolder(connectionFactoryConfiguration.GetConnection, connectionFactoryConfiguration.ReleaseConnection);
        }
开发者ID:kubo08,项目名称:Orchard,代码行数:8,代码来源:LdapService.cs


示例15: WindowAuthetification

        public WindowAuthetification(string connection, AuthType type, string currentAdmin=null, AdminInfo originalInfo=null)
        {
            InitializeComponent();

            Connection = connection;
            TYPE_ = type;
            Father_ = currentAdmin;
            original = originalInfo;
        }
开发者ID:krukovden,项目名称:MyProjects,代码行数:9,代码来源:WindowAuthetification.xaml.cs


示例16: DoPtcLogin

 /// <summary>
 /// Returns true if the login worked
 /// </summary>
 /// <param name="username"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 public async Task<string> DoPtcLogin(string username, string password)
 {            
     Logger.Write("Starting PTC login");
     _accessToken = await PtcLogin.GetAccessToken(username, password);
     _authType = AuthType.Ptc;
     await SetServer();
     Logger.Write("PTC login completed (" + !string.IsNullOrEmpty(_accessToken) + ")");
     return _accessToken;
 }
开发者ID:ZunlabResearch,项目名称:PoGo-UWP,代码行数:15,代码来源:Client.cs


示例17: CertificateVerificationResult

		/// <summary>
		/// Initializes a new CertificateVerificationResult instance.
		/// </summary>
		/// <param name="chain">The <see cref="CertificateChain"/> that has to be verified.</param>
		/// <param name="server">The server to which the <see cref="Certificate"/> has been issued.</param>
		/// <param name="type">One of the <see cref="AuthType"/> values.</param>
		/// <param name="flags">One of the <see cref="VerificationFlags"/> values.</param>
		/// <param name="callback">The delegate to call when the verification finishes.</param>
		/// <param name="asyncState">User-defined state data.</param>
		public CertificateVerificationResult(CertificateChain chain, string server, AuthType type, VerificationFlags flags, AsyncCallback callback, object asyncState) {
			m_Chain = chain;
			m_Server = server;
			m_Type = type;
			m_Flags = flags;
			m_AsyncState = asyncState;
			m_Callback = callback;
			m_WaitHandle = null;
			m_HasEnded = false;
		}
开发者ID:JnS-Software-LLC,项目名称:iiop-net,代码行数:19,代码来源:CertificateVerificationResult.cs


示例18: CreateAuth

 /// <summary>
 /// CreateAuth
 /// </summary>
 public static OAuthBase CreateAuth(AuthType type)
 {
     switch (type)
     {
         case AuthType.Facebook:
             return new OAuthFacebook();
         default:
             return null;
     }
 }
开发者ID:858project,项目名称:net.858project.dll,代码行数:13,代码来源:OAuthBase.cs


示例19: RequestBuilder

 public RequestBuilder(string authToken, AuthType authType, double latitude, double longitude, double altitude,
     AuthTicket authTicket = null)
 {
     _authToken = authToken;
     _authType = authType;
     _latitude = latitude;
     _longitude = longitude;
     _altitude = altitude;
     _authTicket = authTicket;
 }
开发者ID:ChainsawPolice,项目名称:HaxtonBot,代码行数:10,代码来源:RequestBuilder.cs


示例20: LoginShouldDelegateToAuthenticationManagerWithCorrectParameters

        public void LoginShouldDelegateToAuthenticationManagerWithCorrectParameters(string login, string secret, AuthType authType)
        {
            var authenticationManager = Substitute.For<IAuthenticationManager>();

            var client = new Client(null, null) {AuthenticationManager = authenticationManager};

            client.Login(login, secret, authType);

            authenticationManager.Received(1).Login(login, secret, authType);
        }
开发者ID:srabya,项目名称:usergrid-.net-sdk,代码行数:10,代码来源:LoginTests.cs



注:本文中的AuthType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Authenticate类代码示例发布时间:2022-05-24
下一篇:
C# AuthRepository类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap