本文整理汇总了C#中AuthType类的典型用法代码示例。如果您正苦于以下问题:C# AuthType类的具体用法?C# AuthType怎么用?C# AuthType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthType类属于命名空间,在下文中一共展示了AuthType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例3: CreateTokenCommand
/// <summary>
/// 构造函数
/// </summary>
public CreateTokenCommand(string clientId, AuthType authType)
{
Guard.IsNotNullOrEmpty(clientId, "clientId");
this.ClientId = clientId;
AuthType = authType;
TimeOut = 3600;
}
示例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
}
示例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);
}
示例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
}
示例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
}
};
}
示例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;
}
}
示例9: SessionManager
public SessionManager(int appId, int perms)
{
this.sessions = new List<SessionInfo>();
this.AppId = appId;
this.Permissions = perms;
this.AuthorizationType = AuthType.VKAuth;
}
示例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");
}
示例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
}
示例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;
}
示例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;
}
示例14: GetConnectionForCore
protected ConnectionHolder GetConnectionForCore(NetworkCredential credential, AuthType authType = AuthType.Basic)
{
connectionFactoryConfiguration
.AuthenticateBy(authType)
.AuthenticateAs(credential);
return new ConnectionHolder(connectionFactoryConfiguration.GetConnection, connectionFactoryConfiguration.ReleaseConnection);
}
示例15: WindowAuthetification
public WindowAuthetification(string connection, AuthType type, string currentAdmin=null, AdminInfo originalInfo=null)
{
InitializeComponent();
Connection = connection;
TYPE_ = type;
Father_ = currentAdmin;
original = originalInfo;
}