コード例 #1
0
        /// <summary>
        /// Authenticate the credentials against the configuration database.
        /// </summary>
        /// <param name="credentials">A credential object such as a <see cref="NamePasswordCredential"/>.</param>
        /// <param name="userIdentity">An <see cref="IIdentity"/> object representing
        /// authenticated credentials returned if successfull.</param>
        /// <returns><strong>True</strong> if authentication was
        /// successful, otherwise false.</returns>
        /// <remarks>
        /// This method call is intended to be overloaded to support additional
        /// credential objects if/when they are brought online.
        /// </remarks>
        public bool Authenticate(object credentials, out IIdentity userIdentity)
        {
            bool result = false;

            userIdentity = null;

            NamePasswordCredential namePasswordCredentials = credentials as NamePasswordCredential;

            if (namePasswordCredentials != null && namePasswordCredentials.Name.Length > 0)
            {
                SecurityAuthenticationCheckEvent.Fire(namePasswordCredentials.Name);

                result = PasswordsMatch(namePasswordCredentials.PasswordBytes, namePasswordCredentials.Name);

                if (result)
                {
                    userIdentity = new GenericIdentity(namePasswordCredentials.Name, GetAuthenticationType());
                }
                else
                {
                    SecurityAuthenticationFailedEvent.Fire(namePasswordCredentials.Name);
                }
            }

            return(result);
        }
コード例 #2
0
ファイル: WMIEventsFixture.cs プロジェクト: smillea1/NCS-V1-1
 private void FireSecurityAuthenticationFailedEvent()
 {
     SecurityAuthenticationFailedEvent.Fire(testMessage);
 }
コード例 #3
0
 private void FireSecurityAuthenticationFailureEvent()
 {
     SecurityAuthenticationFailedEvent.Fire("test");
 }