public AuthenticationInformationProvider( AuthenticationInformation profileAuthenticationInformation, AuthenticationInformation serviceAuthenticationInformation) { _profileAuthenticationInformation = profileAuthenticationInformation; _serviceAuthenticationInformation = serviceAuthenticationInformation; }
private void mnuCreateLiveAutoLogin_Click(object sender, RoutedEventArgs e) { #if !LIVECONNECT if (string.IsNullOrEmpty(UserSettings.Default.AuthenticationBlob)) { AuthenticationInformation info = new AuthenticationInformation(); try { PassportHelper.TryAuthenticate(ref info); if (string.IsNullOrEmpty(info.AuthBlob)) { MessageBox.Show(this, "Failed to get authentication blob!"); } else { UserSettings.Default.AuthenticationBlob = info.AuthBlob; UserSettings.Default.Save(); ApplySettings(); MessageBox.Show(this, "Authentication blob received; autologin activated."); } } catch { MessageBox.Show(this, "Failed to get authentication blob!"); } } else { UserSettings.Default.AuthenticationBlob = string.Empty; UserSettings.Default.Save(); ApplySettings(); MessageBox.Show(this, "Authentication login disabled. You should *restart* the bridge to reset the LiveId component!"); } #endif }
public override SecurityToken CreateToken(SecurityTokenDescriptor tokenDescriptor) { var methodString = tokenDescriptor.Subject?.FindFirst(ClaimTypes.AuthenticationMethod)?.Value; var instantString = tokenDescriptor.Subject?.FindFirst(ClaimTypes.AuthenticationInstant)?.Value; if (methodString != null && Uri.TryCreate(methodString, UriKind.Absolute, out var method) && instantString != null && DateTime.TryParse(instantString, out var instant)) { var information = new AuthenticationInformation(method, instant); return(CreateToken(tokenDescriptor, information)); } return(base.CreateToken(tokenDescriptor)); }
public virtual AuthenticationInformation GetAuthFromEmail(string email) { AuthenticationInformation auth = new AuthenticationInformation(); auth.UserID = GetUserIDFromEmail(email); auth.TokenSalt = GetTokenSaltFromUID(auth.UserID); if (auth.UserID == string.Empty || auth.TokenSalt == string.Empty) { return(null); } return(auth); }
public IActionResult SignIn(AuthenticationInformation authenticationModel) { if (!AuthenticationService.ValidateCredentials(authenticationModel.Username, authenticationModel.Password)) { return(View(authenticationModel)); } else { HttpContext.Session.SetString("currentUsername", authenticationModel.Username); HttpContext.Session.SetInt32("currentUserId", AuthenticationService.GetUserId(authenticationModel.Username).Value); return(RedirectToAction("LocationSelection", "Location")); } }
public void TestLogOn() { var authenticationApi = this.AuthenticationApi; Assert.IsNotNull(authenticationApi); string account = ConfigurationManager.AppSettings["dsm_account"]; string password = ConfigurationManager.AppSettings["dsm_password"]; AuthenticationInformation authenticationInformation = authenticationApi.LogOn(account, password).Result; Assert.IsNotNull(authenticationInformation); Assert.IsFalse(string.IsNullOrEmpty(authenticationInformation.Sid)); }
private static void ConfigureOptions(JwtBearerOptions options, AuthenticationInformation authenticationInformation) { options.RequireHttpsMetadata = authenticationInformation.RequireHttpsMetadata; options.Audience = authenticationInformation.TokenValidationParameters.ValidAudiences.First(); options.TokenValidationParameters = authenticationInformation.TokenValidationParameters; options.Authority = options.TokenValidationParameters.ValidIssuer; // HACK: Avoid getting .well-known when using local tokens. if (options.Authority == LocalAuthentication.Issuer) { options.Configuration = new OpenIdConnectConfiguration { Issuer = options.Authority }; options.Configuration.SigningKeys.Add(options.TokenValidationParameters.IssuerSigningKey); } options.Events = new JwtBearerEvents { OnMessageReceived = async context => { var queryToken = context.Request.Query["access_token"].FirstOrDefault(); var headerToken = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(' ')[1]; // If the request is for our hub... var path = context.HttpContext.Request.Path; if (path.StartsWithSegments("/hub")) { var token = queryToken ?? headerToken; if (token == null) { return; } var realtimeAuthenticationClient = context.HttpContext.RequestServices.GetRequiredService <RealtimeAuthenticationClient>(); var actualTokenValue = await realtimeAuthenticationClient.GetRealtimeAuthValueAsync(token) .ConfigureAwait(false); if (string.IsNullOrEmpty(actualTokenValue)) { return; } // Read the token out of the query string context.Token = actualTokenValue; } } }; }
public AuthenticationInformationProvider( AuthenticationInformation profileAuthenticationInformation, IEnumerable <AuthenticationInformation> additionalProfileAuthenticationInformations, AuthenticationInformation serviceAuthenticationInformation) { if (_additionalProfileAuthenticationInformations.Contains(profileAuthenticationInformation)) { throw new InvalidOperationException("Additional profile authentication informations cannot contain primary entry."); } _profileAuthenticationInformation = profileAuthenticationInformation; _additionalProfileAuthenticationInformations = additionalProfileAuthenticationInformations; _serviceAuthenticationInformation = serviceAuthenticationInformation; }
public IActionResult SignIn() { if (HttpContext.Session.GetString("currentUsername") != null) { return(RedirectToAction("LocationSelection", "Location")); } AuthenticationInformation authenticationModel = new AuthenticationInformation(); if (Request.Headers["x-requested-with"] == "XMLHttpRequest") { return(PartialView(authenticationModel)); } return(View(authenticationModel)); }
private static AuthenticationResult?TryValidateToken(string accessToken, AuthenticationInformation authenticationInformation) { var handler = new JwtSecurityTokenHandler(); try { var user = handler.ValidateToken( accessToken, authenticationInformation.TokenValidationParameters, out var validatedToken); if (validatedToken is JwtSecurityToken jwtSecurityToken) { return(new AuthenticationResult(user, jwtSecurityToken)); } } catch (SecurityTokenUnableToValidateException) { // TODO: Log failing to validate the token. } return(null); }
public override SecurityToken CreateToken(SecurityTokenDescriptor tokenDescriptor, AuthenticationInformation authenticationInformation) { var saml2 = base.CreateToken(tokenDescriptor, authenticationInformation) as Saml2SecurityToken; var authnStatement = saml2.Assertion.Statements.OfType <Saml2AuthenticationStatement>().FirstOrDefault(); if (authnStatement != null) { authnStatement.SessionIndex = saml2.Id; } return(saml2); }
private void LoadCurrentUserInfo(AuthenticationInformation info) { currentAccount = DR_Accounts.ResolveFromOpenID(info.OpenIdentifier); }
private NephosAuthenticationManager(AuthenticationInformation authInfo) { this.authInfo = authInfo; this.storageManager = null; }
private static void StartBridgeInternal(MainWindow t, int port, string domainName) { //var services = new[] { "social", "answers" }; var services = new[] { "social" }; //var serviceModel = System.Configuration.ConfigurationManager.GetSection("system.serviceModel"); string authenticationTicket = null; #if LIVECONNECT Traces.Main_TraceEvent(TraceEventType.Verbose, 1, "LiveConnect: Try authentication"); t.DoLogin(); authenticationTicket = t.AccessToken; if (string.IsNullOrEmpty(authenticationTicket)) { // Reset the RefreshToken, if the authentication has failed... UserSettings.Default.RefreshToken = string.Empty; Traces.Main_TraceEvent(TraceEventType.Error, 1, "Could not authenticate with LiveConnect!"); throw new ApplicationException("Could not authenticate with LiveConnect!"); } Traces.Main_TraceEvent(TraceEventType.Information, 1, "Authenticated: AccessToken: {0}", authenticationTicket); #else // Authenticate with Live Id var authenticationData = new AuthenticationInformation(); Traces.Main_TraceEvent(TraceEventType.Verbose, 1, "LiveId: Try authentication"); try { PassportHelper.TryAuthenticate(ref authenticationData, UserSettings.Default.AuthenticationBlob); } catch { // Reset the auto login, if the authentication has failed... UserSettings.Default.AuthenticationBlob = string.Empty; throw; } Traces.Main_TraceEvent(TraceEventType.Verbose, 1, "LiveId: UserName: {0}, Ticket: {1}", authenticationData.UserName, authenticationData.Ticket); if (authenticationData.Ticket == null) { // Reset the auto login, if the authentication has failed... UserSettings.Default.AuthenticationBlob = string.Empty; Traces.Main_TraceEvent(TraceEventType.Error, 1, "Could not authenticate with LiveId!"); throw new ApplicationException("Could not authenticate with LiveId!"); } authenticationTicket = authenticationData.Ticket; #endif t._forumsProviders = new MicrosoftForumsServiceProvider[services.Length]; for (var i = 0; i < services.Length; i++) { // Create the forums-ServiceProvider Traces.Main_TraceEvent(TraceEventType.Verbose, 1, "Create forums service provider: {0}", services[i]); var provider = new MicrosoftForumsServiceProvider(services[i]); System.Diagnostics.Debug.WriteLine(string.Format("{0}: Uri: {1}", services[i], provider.Uri)); // Assigne the authentication ticket provider.AuthenticationTicket = authenticationTicket; ApplyForumsDisabled(provider); #if PASSPORT_HEADER_ANALYSIS // Register AuthError-Handler provider.AuthenticationError += t.provider_AuthenticationError; #endif t._forumsProviders[i] = provider; } // Create our DataSource for the forums Traces.Main_TraceEvent(TraceEventType.Verbose, 1, "Creating datasource for NNTP server"); t._forumsDataSource = new ForumDataSource(t._forumsProviders, domainName); t._forumsDataSource.UsePlainTextConverter = UserSettings.Default.UsePlainTextConverter; t._forumsDataSource.AutoLineWrap = UserSettings.Default.AutoLineWrap; t._forumsDataSource.HeaderEncoding = UserSettings.Default.EncodingForClientEncoding; t._forumsDataSource.InMimeUseHtml = (UserSettings.Default.InMimeUse == UserSettings.MimeContentType.TextHtml); t._forumsDataSource.UserDefinedTags = UserSettings.Default.UserDefinedTags; t._forumsDataSource.ShowUserNamePostfix = UserSettings.Default.ShowUserNamePostfix; t._forumsDataSource.PostsAreAlwaysFormatFlowed = UserSettings.Default.PostsAreAlwaysFormatFlowed; t._forumsDataSource.TabAsSpace = UserSettings.Default.TabAsSpace; t._forumsDataSource.UseCodeColorizer = UserSettings.Default.UseCodeColorizer; t._forumsDataSource.AddHistoryToArticle = UserSettings.Default.AddHistoryToArticle; // Now start the NNTP-Server Traces.Main_TraceEvent(TraceEventType.Verbose, 1, "Starting NNTP server"); t._nntpServer = new NNTPServer.NntpServer(t._forumsDataSource, true); t._nntpServer.EncodingSend = UserSettings.Default.EncodingForClientEncoding; t._nntpServer.ListGroupDisabled = UserSettings.Default.DisableLISTGROUP; //t._nntpServer.DetailedErrorResponse = detailedErrorResponse; string errorMessage; t._nntpServer.Start(port, 64, UserSettings.Default.BindToWorld, out errorMessage); if (errorMessage != null) { throw new ApplicationException(errorMessage); } }
public static AuthDataEntry SignedKeyAuthenticate(string stringToSign, string requestSignature, AuthenticationInformation authInfo) { AuthDataEntry authDataEntry; NephosAssertionException.Assert(!string.IsNullOrEmpty(stringToSign)); NephosAssertionException.Assert(!string.IsNullOrEmpty(requestSignature)); NephosAssertionException.Assert(authInfo != null); RequestContext requestContext = authInfo.RequestContext; NephosUriComponents uriComponents = authInfo.UriComponents; NameValueCollection queryParameters = requestContext.QueryParameters; string item = queryParameters["st"]; string str = queryParameters["se"]; string item1 = queryParameters["sp"]; string str1 = queryParameters["si"]; string item2 = queryParameters["sip"]; string str2 = queryParameters["spr"]; string item3 = queryParameters["sv"]; string str3 = queryParameters["sep"]; authInfo.AuthKeyName = AuthenticationManagerHelper.ExtractKeyNameFromParamsWithConversion(queryParameters); byte[] sign = QueueSignedAccessHelper.ComputeUrlDecodedUtf8EncodedStringToSign(item, str, item1, str1, item2, str2, item3, str3, uriComponents); using (IEnumerator <AuthDataEntry> enumerator = SharedKeyAuthInfoHelper.GetSharedKeys(authInfo).GetEnumerator()) { while (enumerator.MoveNext()) { AuthDataEntry current = enumerator.Current; byte[] numArray = SASUtilities.ComputeSignedKey(sign, current.AuthValue); if (!SASUtilities.ComputeSignatureAndCompare((new UTF8Encoding()).GetBytes(stringToSign), numArray, requestSignature)) { continue; } authDataEntry = current; return(authDataEntry); } CultureInfo invariantCulture = CultureInfo.InvariantCulture; object[] objArray = new object[] { requestSignature, stringToSign }; throw new AuthenticationFailureException(string.Format(invariantCulture, "The MAC signature found in the HTTP request '{0}' is not the same as any computed signature. Server used following string to sign: '{1}'.", objArray)); } return(authDataEntry); }
public override SecurityToken CreateToken(SecurityTokenDescriptor tokenDescriptor, AuthenticationInformation authenticationInformation) { var token = base.CreateToken(tokenDescriptor, authenticationInformation) as Saml2SecurityToken; if (tokenDescriptor?.EncryptingCredentials == null) { return(token); } return(new Saml2EncryptedSecurityToken(token, tokenDescriptor.EncryptingCredentials)); }
private static AuthDataEntry SharedKeyAuthenticate(string stringToSign, string requestSignature, AuthenticationInformation authInfo) { AuthDataEntry item; object[] objArray; object[] objArray1; IStringDataEventStream authenticationFailure; CultureInfo invariantCulture; if (string.IsNullOrEmpty(stringToSign)) { CultureInfo cultureInfo = CultureInfo.InvariantCulture; object[] authScheme = new object[] { authInfo.AuthScheme }; throw new AuthenticationFailureException(string.Format(cultureInfo, "String to sign for auth scheme {0} cannot be null or empty.", authScheme)); } NephosAssertionException.Assert(!string.IsNullOrEmpty(requestSignature)); try { Convert.FromBase64String(requestSignature); } catch (FormatException formatException) { throw new InvalidAuthenticationInfoException("Signature is not a valid base64 string.", formatException); } Collection <AuthDataEntry> sharedKeys = SharedKeyAuthInfoHelper.GetSharedKeys(authInfo); if (sharedKeys.Count > 0) { HMAC authValue = HMACCryptoCache.Instance.Acquire(sharedKeys[0].AuthValue); try { int num = 0; while (num < sharedKeys.Count) { authValue.Key = sharedKeys[num].AuthValue; string str = MessageHashFunctions.ComputeMacWithSpecificAlgorithm(authValue, stringToSign); if (!AuthenticationManager.AreSignaturesEqual(str, requestSignature)) { IStringDataEventStream infoDebug = Logger <IRestProtocolHeadLogger> .Instance.InfoDebug; object[] objArray2 = new object[] { stringToSign, str, requestSignature }; infoDebug.Log("Authentication Debug. stringToSign: {0}, computedSignature: {1}, requestSignature: {2}", objArray2); IStringDataEventStream stringDataEventStream = Logger <IRestProtocolHeadLogger> .Instance.AuthenticationFailure; object[] objArray3 = new object[] { num + 1 }; stringDataEventStream.Log("SecurityWarning: Authentication attempt failed against key {0}.", objArray3); num++; } else { item = sharedKeys[num]; return(item); } } authenticationFailure = Logger <IRestProtocolHeadLogger> .Instance.AuthenticationFailure; objArray = new object[] { stringToSign }; authenticationFailure.Log("SecurityWarning: Authentication failed due to signature mismatch. Server's stringtosign value is {0}", objArray); invariantCulture = CultureInfo.InvariantCulture; objArray1 = new object[] { requestSignature, stringToSign }; throw new AuthenticationFailureException(string.Format(invariantCulture, "The MAC signature found in the HTTP request '{0}' is not the same as any computed signature. Server used following string to sign: '{1}'.", objArray1)); } finally { HMACCryptoCache.Instance.Release(authValue); } return(item); } authenticationFailure = Logger <IRestProtocolHeadLogger> .Instance.AuthenticationFailure; objArray = new object[] { stringToSign }; authenticationFailure.Log("SecurityWarning: Authentication failed due to signature mismatch. Server's stringtosign value is {0}", objArray); invariantCulture = CultureInfo.InvariantCulture; objArray1 = new object[] { requestSignature, stringToSign }; throw new AuthenticationFailureException(string.Format(invariantCulture, "The MAC signature found in the HTTP request '{0}' is not the same as any computed signature. Server used following string to sign: '{1}'.", objArray1)); }
private IEnumerator <IAsyncResult> AuthenticateImpl(IStorageAccount storageAccount, RequestContext requestContext, NephosUriComponents uriComponents, AuthenticationManager.GetStringToSignCallback getStringToSignCallback, TimeSpan timeout, AsyncIteratorContext <IAuthenticationResult> context) { SupportedAuthScheme?nullable; IStorageAccount operationStatus; context.ResultData = null; if (getStringToSignCallback == null) { throw new ArgumentNullException("getStringToSignCallback"); } string str = null; string str1 = null; bool flag = false; NephosAuthenticationManager.ParseSignatureParametersFromAuthorizationHeader(requestContext, uriComponents, false, out str, out str1, out nullable, out flag); if (!flag) { NephosAssertionException.Assert(nullable.HasValue, "Request Authentication Scheme should have a value"); IAccountIdentifier accountIdentifier = null; AuthenticationInformation authInfoForScheme = null; if (this.storageManager != null) { if (storageAccount == null || !storageAccount.Name.Equals(str)) { try { operationStatus = this.storageManager.CreateAccountInstance(str); if (requestContext != null) { operationStatus.OperationStatus = requestContext.OperationStatus; } } catch (ArgumentOutOfRangeException argumentOutOfRangeException) { throw new AuthenticationFailureException(string.Format(CultureInfo.InvariantCulture, "The account name is invalid.", new object[0])); } operationStatus.Timeout = timeout; IAsyncResult asyncResult = operationStatus.BeginGetProperties(AccountPropertyNames.All, null, context.GetResumeCallback(), context.GetResumeState("NephosAuthenticationManager.AuthenticateImpl")); yield return(asyncResult); try { operationStatus.EndGetProperties(asyncResult); } catch (AccountNotFoundException accountNotFoundException1) { AccountNotFoundException accountNotFoundException = accountNotFoundException1; CultureInfo invariantCulture = CultureInfo.InvariantCulture; object[] objArray = new object[] { str }; throw new AuthenticationFailureException(string.Format(invariantCulture, "Cannot find the claimed account when trying to GetProperties for the account {0}.", objArray), accountNotFoundException); } catch (Exception exception1) { Exception exception = exception1; IStringDataEventStream warning = Logger <IRestProtocolHeadLogger> .Instance.Warning; warning.Log("Rethrow exception when trying to GetProperties for the account {0}: {1}", new object[] { str, exception }); throw; } } else { operationStatus = storageAccount; if (requestContext != null) { operationStatus.OperationStatus = requestContext.OperationStatus; } } authInfoForScheme = NephosAuthenticationManager.GetAuthInfoForScheme(operationStatus, nullable.Value, requestContext, uriComponents, false); if (authInfoForScheme == null) { if (storageAccount != operationStatus) { operationStatus.Dispose(); } CultureInfo cultureInfo = CultureInfo.InvariantCulture; object[] name = new object[] { nullable, operationStatus.Name }; throw new AuthenticationFailureException(string.Format(cultureInfo, "Authentication scheme {0} is not supported by account {1}.", name)); } SecretKeyPermissions permissions = SecretKeyPermissions.Full; if (authInfoForScheme.NamedKeyAuthData != null) { permissions = authInfoForScheme.NamedKeyAuthData.Permissions; } accountIdentifier = new AccountIdentifier(operationStatus, permissions); if (storageAccount != operationStatus) { operationStatus.Dispose(); } } string str2 = null; try { str2 = getStringToSignCallback(requestContext, uriComponents, nullable.Value); } catch (NotSupportedException notSupportedException) { CultureInfo invariantCulture1 = CultureInfo.InvariantCulture; object[] objArray1 = new object[] { nullable }; throw new AuthenticationFailureException(string.Format(invariantCulture1, "Authentication scheme {0} is not supported.", objArray1)); } AuthenticationMethod item = NephosAuthenticationManager.serviceAuthMethodsTable[requestContext.ServiceType][nullable.Value]; item(str2, str1, authInfoForScheme); NephosAssertionException.Assert(accountIdentifier != null); context.ResultData = new AuthenticationResult(accountIdentifier, null, false); } else { context.ResultData = new AuthenticationResult(AuthenticationManager.AnonymousAccount, null, false); } }
public IActionResult SignIn() { AuthenticationInformation authenticationModel = new AuthenticationInformation(); return(View(authenticationModel)); }
private static void StartBridgeInternal(MainWindow t, int port) { string authenticationTicket = null; #if LIVECONNECT Traces.Main_TraceEvent(TraceEventType.Verbose, 1, "LiveConnect: Try authentication"); t.DoLogin(); authenticationTicket = t.AccessToken; if (string.IsNullOrEmpty(authenticationTicket)) { // Reset the RefreshToken, if the authentication has failed... UserSettings.Default.RefreshToken = string.Empty; Traces.Main_TraceEvent(TraceEventType.Error, 1, "Could not authenticate with LiveConnect!"); throw new ApplicationException("Could not authenticate with LiveConnect!"); } Traces.Main_TraceEvent(TraceEventType.Information, 1, "Authenticated: AccessToken: {0}", authenticationTicket); #else // Authenticate with Live Id var authenticationData = new AuthenticationInformation(); Traces.Main_TraceEvent(TraceEventType.Verbose, 1, "LiveId: Try authentication"); try { PassportHelper.TryAuthenticate(ref authenticationData, UserSettings.Default.AuthenticationBlob); } catch { // Reset the auto login, if the authentication has failed... UserSettings.Default.AuthenticationBlob = string.Empty; throw; } Traces.Main_TraceEvent(TraceEventType.Verbose, 1, "LiveId: UserName: {0}, Ticket: {1}", authenticationData.UserName, authenticationData.Ticket); if (authenticationData.Ticket == null) { // Reset the auto login, if the authentication has failed... UserSettings.Default.AuthenticationBlob = string.Empty; Traces.Main_TraceEvent(TraceEventType.Error, 1, "Could not authenticate with LiveId!"); throw new ApplicationException("Could not authenticate with LiveId!"); } authenticationTicket = authenticationData.Ticket; #endif string baseUrl = System.Configuration.ConfigurationManager.AppSettings["BaseUrl"]; var rest = new ForumsRestService.ServiceAccess("tZNt5SSBt1XPiWiueGaAQMnrV4QelLbm7eum1750GI4=", baseUrl); rest.AuthenticationTicket = authenticationTicket; //rest.GetForums(); // Create the forums-ServiceProvider Traces.Main_TraceEvent(TraceEventType.Verbose, 1, "Create forums service provider"); //var provider = new MicrosoftForumsServiceProvider(services[i]); //System.Diagnostics.Debug.WriteLine(string.Format("{0}: Uri: {1}", services[i], provider.Uri)); // Assigne the authentication ticket //provider.AuthenticationTicket = authenticationTicket; //ApplyForumsDisabled(provider); #if PASSPORT_HEADER_ANALYSIS // Register AuthError-Handler provider.AuthenticationError += t.provider_AuthenticationError; #endif //t._forumsProviders[i] = provider; // Create our DataSource for the forums Traces.Main_TraceEvent(TraceEventType.Verbose, 1, "Creating datasource for NNTP server"); t._forumsDataSource = new DataSourceMsdnRest(rest); t._forumsDataSource.UsePlainTextConverter = UserSettings.Default.UsePlainTextConverter; t._forumsDataSource.AutoLineWrap = UserSettings.Default.AutoLineWrap; t._forumsDataSource.HeaderEncoding = UserSettings.Default.EncodingForClientEncoding; t._forumsDataSource.InMimeUseHtml = (UserSettings.Default.InMimeUse == UserSettings.MimeContentType.TextHtml); t._forumsDataSource.PostsAreAlwaysFormatFlowed = UserSettings.Default.PostsAreAlwaysFormatFlowed; t._forumsDataSource.TabAsSpace = UserSettings.Default.TabAsSpace; t._forumsDataSource.UseCodeColorizer = UserSettings.Default.UseCodeColorizer; t._forumsDataSource.ProgressData += t._forumsDataSource_ProgressData; // Now start the NNTP-Server Traces.Main_TraceEvent(TraceEventType.Verbose, 1, "Starting NNTP server"); t._nntpServer = new NNTPServer.NntpServer(t._forumsDataSource, true); t._nntpServer.EncodingSend = UserSettings.Default.EncodingForClientEncoding; t._nntpServer.ListGroupDisabled = UserSettings.Default.DisableLISTGROUP; string errorMessage; t._nntpServer.Start(port, 64, UserSettings.Default.BindToWorld, out errorMessage); if (errorMessage != null) { throw new ApplicationException(errorMessage); } }
public override SecurityToken CreateToken(SecurityTokenDescriptor tokenDescriptor, AuthenticationInformation authenticationInformation) { var token = base.CreateToken(tokenDescriptor, null) as Saml2SecurityToken; if (authenticationInformation != null) { if (authenticationInformation.Session == null) { authenticationInformation.Session = token.Assertion.Id.Value; } var authnStatement = CreateAuthenticationStatement(authenticationInformation); token.Assertion.Statements.Add(authnStatement); } return(token); }
private void HandleWelcomeMessage(string msg) { MessageWelcome welcomeMsg = (MessageWelcome)JsonConvert.DeserializeObject(msg, typeof(MessageWelcome)); ServerVersion = welcomeMsg.Server_Version; // We have some autologin going, ignore welcome message if (autologinKey != null) { return; } switch (welcomeMsg.AuthMethod) { // AuthMethod: User&Password or Both case 1: case 3: MessageIdentify identificationMessage = new MessageIdentify(); identificationMessage.Authenticate = new Authenticate(AuthenticationInformation.Username, AuthenticationInformation.GetPassword()); SendCommand(identificationMessage); break; // AuthMethod: Passcode case 2: Log.Warn("WifiRemoteClient: Passcode authentication not yet implemented"); break; // AuthMethod: None case 0: default: SendCommand(new MessageIdentify()); break; } }
private NephosAuthenticationManager(IStorageManager manager) { this.storageManager = manager; this.authInfo = null; }