{"id":22640920,"url":"https://github.com/aliencube/microsoft-adal-wrapper","last_synced_at":"2025-04-11T22:20:45.961Z","repository":{"id":144199607,"uuid":"61035944","full_name":"aliencube/Microsoft-ADAL-Wrapper","owner":"aliencube","description":"This provides a wrapper library for ADAL - https://www.nuget.org/packages/Microsoft.IdentityModel.Clients.ActiveDirectory","archived":false,"fork":false,"pushed_at":"2018-07-23T14:05:11.000Z","size":1217,"stargazers_count":6,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T00:45:36.726Z","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/aliencube.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":"2016-06-13T12:50:50.000Z","updated_at":"2022-03-18T15:08:45.000Z","dependencies_parsed_at":"2023-06-16T19:22:26.294Z","dependency_job_id":null,"html_url":"https://github.com/aliencube/Microsoft-ADAL-Wrapper","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliencube%2FMicrosoft-ADAL-Wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliencube%2FMicrosoft-ADAL-Wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliencube%2FMicrosoft-ADAL-Wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliencube%2FMicrosoft-ADAL-Wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aliencube","download_url":"https://codeload.github.com/aliencube/Microsoft-ADAL-Wrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487667,"owners_count":21112191,"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","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":"2024-12-09T04:14:55.379Z","updated_at":"2025-04-11T22:20:45.940Z","avatar_url":"https://github.com/aliencube.png","language":"C#","readme":"# Microsoft ADAL Wrapper #\n\n[![Build status](https://ci.appveyor.com/api/projects/status/euwt8ald8yam5ptc/branch/dev?svg=true)](https://ci.appveyor.com/project/justinyoo/microsoft-adal-wrapper/branch/dev) | [![](https://img.shields.io/nuget/v/Aliencube.AdalWrapper.svg)](https://www.nuget.org/packages/Aliencube.AdalWrapper)\n\nThis provides a wrapper library for ADAL - [https://www.nuget.org/packages/Microsoft.IdentityModel.Clients.ActiveDirectory](https://www.nuget.org/packages/Microsoft.IdentityModel.Clients.ActiveDirectory).\n\nADAL provides many classes marked as `sealed`. This doesn't only prevent us from inheriting, but also blocks mocking. In order to mock those classes, we need wrapper classes for them. This library provides wrapper classes for those defined in ADAL.\n\n\n## Getting Started ##\n\nThe `AuthenticationContext` is the main class most frequently used in ADAL, which is marked as `sealed`. Therefore, it order to use a wrapper for this, simply follow the step below:\n\n```csharp\nvar authority = \"https://login.microsoftonline.com/[TENANT_NAME].onmicrosoft.com\";\nvar resource = \"https://management.core.windows.net/\";\n\nvar clientId = \"[CLIENT_ID]\";\nvar clientSecret = \"[CLIENT_SECRET]\";\nvar credential = new ClientCredential(clientId, clientSecret);\n\nusing (var context = new AuthenticationContextWrapper(authority))\n{\n  var result = await context.AcquireTokenAsync(resource, credential);\n}\n```\n\nThis offers the same development experience as existing ADAL's `AuthenticationContext` class. However, if you need to mock `AuthenticationContext`, this wrapper library will offer you powerful development experiences like:\n\n```csharp\nvar result = new Mock\u003cIAuthenticationResultWrapper\u003e();\nresult.SetupGet(p =\u003e p.AccessToken).Returns(\"[ACCESS_TOKEN]\");\n\nvar wrapper = new Mock\u003cIAuthenticationContextWrapper\u003e();\nwrapper.Setup(p =\u003e p.AcquireTokenAsync(It.IsAny\u003cstring\u003e(), It.IsAny\u003cClientCredential\u003e())).ReturnsAsync(result.Object);\n```\n\nBy doing so, those `AuthenticationContext` and `AuthenticationResult` are under our control for mocking by their wrapping classes.\n\n\n## Contribution ##\n\nYour contributions are always welcome! All your work should be done in your forked repository. Once you finish your work with corresponding tests, please send us a pull request onto our `dev` branch for review.\n\n\n## License ##\n\n**Microsoft ADAL Wrapper** is released under [MIT License](http://opensource.org/licenses/MIT)\n\n\u003e The MIT License (MIT)\n\u003e\n\u003e Copyright (c) 2016 [aliencube.org](http://aliencube.org)\n\u003e \n\u003e Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\u003e \n\u003e The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\u003e \n\u003e THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliencube%2Fmicrosoft-adal-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faliencube%2Fmicrosoft-adal-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliencube%2Fmicrosoft-adal-wrapper/lists"}