Ilumnis Authentication

User Class

Represents a user in Ilumnis user rights / authentication implementation.

For a list of all members of this type, see User Members.

System.Object
   IExSys.Authentication.Validation.AuthenticationValidator
      IExSys.Authentication.User

public class User : AuthenticationValidator

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Example

Below is a generic example that shows how to use IExSys.Authentication library. Do not try to execute this example, it only shows concepts used in this library.

using IExSys.Authentication;

namespace IExSys.Authentication.Examples {

    public class Application {
    
        public User CurrentUser = null;
        public Right CreateDirectoryRight = new Right( "CreateDirectory" );
        public Role AdministratorRole = new Role( "Administrator" );

        public void Login(string domain, string userName, string password) {
        
            try {
            
                CurrentUser = new User( domain, userName, password );
            }
            catch {
            
                CurrentUser = null;
            }
        }
        
        public bool CreateDirectory(string directoryPath) {

            try {
            
                if (!CurrentUser.HasRight( CreateDirectoryRight )) {
                
                    return false;
                }
            
                return System.IO.Directory.CreateDirectory( directoryPath ).Exists;
            }
            catch {
            
                return false;
            }
        }
        
        public bool DeleteFile(string filePath) {
        
            try {
            
                if (!CurrentUser.HasRight( "DeleteFile" )) {
            
                    return false;
                }
                
                System.IO.File.Delete( filePath );
                return true;
            }
            catch {
            
                return false;
            }
        }
        
        public bool Format(string driveLetter) {
        
            try {
            
                if (!CurrentUser.HasRole( AdministratorRole )) {
                
                    return false;
                }
                
                DoFormat( driveLetter );
                
            }
            catch {
            
                return false;
            }
        }
    }
}

Requirements

Namespace: IExSys.Authentication

Assembly: IExSys.Authentication (in IExSys.Authentication.dll)

See Also

User Members | IExSys.Authentication Namespace