{"id":29708944,"url":"https://github.com/lithnet/windows-credential-provider","last_synced_at":"2025-07-23T19:08:08.601Z","repository":{"id":65658927,"uuid":"594249317","full_name":"lithnet/windows-credential-provider","owner":"lithnet","description":"A library for creating secure Windows Credential Providers in .NET","archived":false,"fork":false,"pushed_at":"2024-10-21T20:51:53.000Z","size":241,"stargazers_count":39,"open_issues_count":2,"forks_count":5,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-07-22T05:58:35.691Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lithnet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-28T00:28:20.000Z","updated_at":"2025-07-16T15:54:17.000Z","dependencies_parsed_at":"2023-11-11T06:22:44.167Z","dependency_job_id":"f6760a83-29ae-46ce-9109-46c89541b592","html_url":"https://github.com/lithnet/windows-credential-provider","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/lithnet/windows-credential-provider","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithnet%2Fwindows-credential-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithnet%2Fwindows-credential-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithnet%2Fwindows-credential-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithnet%2Fwindows-credential-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lithnet","download_url":"https://codeload.github.com/lithnet/windows-credential-provider/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithnet%2Fwindows-credential-provider/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266737764,"owners_count":23976395,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-23T19:08:08.018Z","updated_at":"2025-07-23T19:08:08.588Z","avatar_url":"https://github.com/lithnet.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://github.com/lithnet/miis-powershell/wiki/images/logo-ex-small.png)\n\n# Windows Credential Provider\n![](https://img.shields.io/nuget/vpre/lithnet.credentialprovider?label=Current%20prerelease)![](https://img.shields.io/nuget/v/Lithnet.CredentialProvider?label=Current%20release)\n![](https://img.shields.io/nuget/dt/lithnet.credentialprovider)\n\nA library for creating secure Windows Credential Providers in .NET, without the COM complications.\n\nThe Lithnet Credential Provider for Windows provides an easy way to create a credential provider, without having to implement the COM components. The COM components are still there, but abstracted away into a fully managed implementation.\n\n## Getting started\n* Create a new Class Library project. You can use .NET Framework 4.6.1 or higher, or you can use .NET 6.0 or higher) to create your provider. You must build as either an x64 or x86 binary. You cannot use AnyCPU.\n* Install the package from nuget `Install-Package Lithnet.CredentialProvider`\n\n* Modify the `csproj` file and set `RegisterForComInterop` to `false`\n```xml\n\u003cPropertyGroup\u003e\n    \u003cTargetFramework\u003enet472\u003c/TargetFramework\u003e\n    \u003cRegisterForComInterop\u003efalse\u003c/RegisterForComInterop\u003e\n    \u003cPlatform\u003ex64\u003c/Platform\u003e\n\u003c/PropertyGroup\u003e\n```\n\n* If you are using .NET 6 or higher, you must also set `EnableComHosting` to `true`\n\n```xml\n\u003cPropertyGroup\u003e\n    \u003cTargetFramework\u003enet6.0-windows\u003c/TargetFramework\u003e\n    \u003cRegisterForComInterop\u003efalse\u003c/RegisterForComInterop\u003e\n    \u003cPlatform\u003ex64\u003c/Platform\u003e\n    \u003cEnableComHosting\u003etrue\u003c/EnableComHosting\u003e\n\u003c/PropertyGroup\u003e\n```\n\n* Create a new class an inherit from `CredentialProviderBase`, as shown below, replacing the `ProgId` and `Guid` values with ones of your own\n\n```cs\n[ComVisible(true)]\n[ClassInterface(ClassInterfaceType.None)]\n[ProgId(\"MyCredentialProvider\")]\n[Guid(\"00000000-0000-0000-0000-000000000000\")]\npublic class MyCredentialProvider : CredentialProviderBase\n{\n}\n```\n\n* Override the `IsUsageScenarioSupported` method, to specify which scenarios you want to support with your credential provider\n\n```cs\npublic override bool IsUsageScenarioSupported(UsageScenario cpus, CredUIWinFlags dwFlags)\n{\n    switch (cpus)\n    {\n        case UsageScenario.Logon:\n        case UsageScenario.UnlockWorkstation:\n        case UsageScenario.CredUI:\n        case UsageScenario.ChangePassword:\n            return true;\n\n        default:\n            return false;\n    }\n}\n```\n\n* Override the  `GetControls` method, and provide the controls to render your UI. You can conditionally render based on the current scenario\n```cs\npublic override IEnumerable\u003cControlBase\u003e GetControls(UsageScenario cpus)\n{\n    yield return new CredentialProviderLabelControl(\"CredProviderLabel\", \"My first credential provider\");\n    \n    var infoLabel = new SmallLabelControl(\"InfoLabel\", \"Enter your username and password please!\");\n    infoLabel.State = FieldState.DisplayInSelectedTile;\n    yield return infoLabel;\n\n    yield return new TextboxControl(\"UsernameField\", \"Username\");\n    var password = new SecurePasswordTextboxControl(\"PasswordField\", \"Password\");\n    yield return password;\n\n    if (cpus == UsageScenario.ChangePassword)\n    {\n        var confirmPassword = new SecurePasswordTextboxControl(\"ConfirmPasswordField\", \"Confirm password\");\n        yield return confirmPassword;\n        yield return new SubmitButtonControl(\"SubmitButton\", \"Submit\", confirmPassword);\n    }\n    else\n    {\n        yield return new SubmitButtonControl(\"SubmitButton\", \"Submit\", password);\n    }\n}\n```\n\n* Windows will ask for the tiles to show. You can determine if you want to show a generic tile (that is, a tile not associated with a user), or a user-specific tile. Windows will provide the list of known users for you to create tiles for.\n```cs\npublic override bool ShouldIncludeUserTile(CredentialProviderUser user)\n{\n    return true;\n}\n\npublic override bool ShouldIncludeGenericTile()\n{\n    return true;\n}\n\npublic override CredentialTile CreateGenericTile()\n{\n    return new MyTile(this);\n}\n\npublic override CredentialTile2 CreateUserTile(CredentialProviderUser user)\n{\n    return new MyTile(this, user);\n}\n```\n\n* Create your tile class. Inherit from `CredentialTile2` if you want to create personalized tiles supported by Windows 8 and later, or `CredentialTile1` if you only want to implement a generic tile. Grab the instances of your controls in the `Initialize` method, so you can attach to their properties to read and respond to value changes. Finally, override the `GetCredentials` method, which is called when the user clicks the submit button.\n\n```cs\npublic class MyTile : CredentialTile2\n{\n    private TextboxControl UsernameControl;\n    private SecurePasswordTextboxControl PasswordControl;\n    private SecurePasswordTextboxControl PasswordConfirmControl;\n\n    public MyTile(CredentialProviderBase credentialProvider) : base(credentialProvider)\n    {\n    }\n\n    public MyTile(CredentialProviderBase credentialProvider, CredentialProviderUser user) : base(credentialProvider, user)\n    {\n    }\n\n    public string Username\n    {\n        get =\u003e UsernameControl.Text;\n        set =\u003e UsernameControl.Text = value;\n    }\n\n    public SecureString Password\n    {\n        get =\u003e PasswordControl.Password;\n        set =\u003e PasswordControl.Password = value;\n    }\n\n    public SecureString ConfirmPassword\n    {\n        get =\u003e PasswordConfirmControl.Password;\n        set =\u003e PasswordConfirmControl.Password = value;\n    }\n\n    public override void Initialize()\n    {\n        if (UsageScenario == UsageScenario.ChangePassword)\n        {\n            this.PasswordConfirmControl = this.Controls.GetControl\u003cSecurePasswordTextboxControl\u003e(\"ConfirmPasswordField\");\n        }\n\n        this.PasswordControl = this.Controls.GetControl\u003cSecurePasswordTextboxControl\u003e(\"PasswordField\");\n        this.UsernameControl = this.Controls.GetControl\u003cTextboxControl\u003e(\"UsernameField\");\n\n        Username = this.User?.QualifiedUserName;\n    }\n\n    protected override CredentialResponseBase GetCredentials()\n    {\n        string username;\n        string domain;\n\n        if (Username.Contains(\"\\\\\"))\n        {\n            domain = Username.Split('\\\\')[0];\n            username = Username.Split('\\\\')[1];\n        }\n        else\n        {\n            username = Username;\n            domain = Environment.MachineName;\n        }\n\n        var spassword = Controls.GetControl\u003cSecurePasswordTextboxControl\u003e(\"PasswordField\").Password;\n\n        return new CredentialResponseSecure()\n        {\n            IsSuccess = true,\n            Password = spassword,\n            Domain = domain,\n            Username = username\n        };\n    }\n}\n\n* Build your project and you have a functional credential provider!\n\n```\n## Installing the credential provider \nYou can use the traditional methods of registering a credential provider (regasm, regsvr32, create registry keys etc), but we've provided a PowerShell module to automatically register your credential provider with a single command.\n\n```powershell\nInstall-Module Lithnet.CredentialProvider.Management\nRegister-CredentialProvider -File C:\\path-to-your-provider.dll\n```\n\nYou can disable, enable, and uninstall the provider with the following commands\n\n```powershell\nDisable-CredentialProvider -File \"C:\\path-to-your-provider.dll\"\nEnable-CredentialProvider -File \"C:\\path-to-your-provider.dll\"\nUnregister-CredentialProvider -File \"C:\\path-to-your-provider.dll\"\n```\n\nOnce the credential provider is registered, you can use the `Invoke-CredUI` cmdlet provided as part of the module, to bring up CredUI window and render your credential provider.\n\n## How can I contribute to the project?\n* Found an issue and want us to fix it? [Log it](https://github.com/lithnet/windows-credential-provider/issues)\n* Want to fix an issue yourself or add functionality? Clone the project and submit a pull request\n\n## Enteprise support\nEnterprise support is not currently offered for this product.\n\n## Keep up to date\n* [Visit our blog](http://blog.lithnet.io)\n* [Follow us on twitter](https://twitter.com/lithnet_io)![](http://twitter.com/favicon.ico)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flithnet%2Fwindows-credential-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flithnet%2Fwindows-credential-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flithnet%2Fwindows-credential-provider/lists"}