GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — npam/src/Npam.Example.User/Program.cs at master · CamW/npam Expand file tree/ Copy pathProgram.csMore file actions executable file ·63 lines (57 loc) · 1.82 KB / Copy pathProgram.csFile metadata and controlsexecutable file ·63 lines (57 loc) · 1.82 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 using System; using Npam; namespace ConsoleApplication { public class Program { //const string PamServiceName = "password-auth"; //For RHEL based Linux const string PamServiceName = "passwd"; public static void Main(string[] args) { Console.Write("Username: "); string user = Console.ReadLine(); Console.Write("Password: "); string password = AcceptInputNoEcho(); if (NpamUser.Authenticate(PamServiceName, user, password)) { Console.WriteLine("AUTHENTICATION - SUCCESS!"); Console.WriteLine("\rUSER GROUPS:"); foreach (var userGroup in NpamUser.GetGroups(user)) { Console.WriteLine("\t{0}", userGroup); } Console.WriteLine("\rUSER INFO:"); Console.WriteLine("\t{0}", NpamUser.GetAccountInfo(user)); } else { Console.WriteLine("AUTHENTICATION - FAILURE!"); } } private static string AcceptInputNoEcho() { string password = ""; while (true) { ConsoleKeyInfo i = Console.ReadKey(true); if (i.Key == ConsoleKey.Enter) { Console.WriteLine(); break; } else if (i.Key == ConsoleKey.Backspace) { if (password.Length > 0) { password = password.Substring(0, password.Length - 1); } } else { password += (i.KeyChar); } } return password; } } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |