dotnet-microsoft-identity-client

LOW
maintainer ChrisTX 0 votes scanned 2026-10-31 05:57:59.662655
View on AUR
Why flagged

Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.

Triggered rules

Low Few votes, recently uploaded zero_votes_recent

Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.

PKGBUILD

1# Maintainer: Christian Pfeiffer <cpfeiffer at rev-crew dot info>
2# shellcheck disable=SC2034,SC2154
3# shellcheck shell=bash
4
5pkgname=dotnet-microsoft-identity-client
6pkgver=4.92.0
7pkgrel=1
8pkgdesc="Microsoft Authentication Library for .NET (MSAL.NET), Microsoft.Identity.Client and its extensions (NuGet packages)"
9arch=('any')
10url='https://github.com/AzureAD/microsoft-authentication-library-for-dotnet'
11license=('MIT')
12_dotnetsdkver="10.0"
13makedepends=(
14 dotnet-sdk-"$_dotnetsdkver"
15)
16# The commit the packages were published from
17_commit="2465fc31fa2b481b68660670e2becfd3fba7c631"
18_packages=(
19 Microsoft.Identity.Client
20 Microsoft.Identity.Client.Extensions.Msal
21)
22source=("microsoft-authentication-library-for-dotnet-$_commit.tar.gz::$url/archive/$_commit.tar.gz")
23sha512sums=('36916817a43a48932081f2758ebc792f0604cbc7f1cf73ca3f7b1517d8b72fb4c1fd6e3ae642daca4fc6ddc055b225cad00102026c3a8b959a6a219b8f723913')
24b2sums=('a07b231b4684edc8f4622c21110da681973d31f40d235475255f198aa791c4c5e69e9170343909d1c55e70ff2e716783e0632ff300fbbcd8d242c727b5a17697')
25
26_dotnet_env() {
27 export NUGET_PACKAGES="$srcdir/nuget"
28 export DOTNET_CLI_HOME="$srcdir/dotnet-home"
29 export DOTNET_CLI_TELEMETRY_OPTOUT=1
30 export DOTNET_NOLOGO=1
31
32 # The version is passed in by the official build. The repository information usually comes from
33 # git, which would find the repository this PKGBUILD is in instead.
34 # Microsoft.IdentityModel.Abstractions from the source-built artifacts is newer than the version
35 # referenced (NU1603).
36 _build_arguments=(
37 --configuration Release
38 -p:MicrosoftIdentityClientVersion="$pkgver"
39 -p:RepositoryCommit="$_commit"
40 -p:RepositoryUrl="$url"
41 -p:SourceRevisionId="$_commit"
42 -p:EnableSourceControlManagerQueries=false
43 -p:WarningsNotAsErrors=NU1603
44 )
45}
46
47# .NET runtime packages MSAL is built against
48_runtimepackages=(
49 Microsoft.IdentityModel.Abstractions
50)
51
52# Writes NuGet.config, taking the runtime packages from the source-built artifacts if prepare() found
53# them there, and everything else from nuget.org like upstream
54_nuget_config() {
55 local _package
56 {
57 cat <<EOF
58<?xml version="1.0" encoding="utf-8"?>
59<configuration>
60 <packageSources>
61 <clear />
62 <add key="dotnet-source-built" value="$srcdir/nuget-local" />
63 <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
64 </packageSources>
65 <packageSourceMapping>
66 <clear />
67EOF
68 if [[ -f "$srcdir/runtime-packages" ]]; then
69 echo ' <packageSource key="dotnet-source-built">'
70 for _package in "${_runtimepackages[@]}"; do
71 echo " <package pattern=\"$_package\" />"
72 done
73 echo ' </packageSource>'
74 fi
75 cat <<EOF
76 <packageSource key="nuget.org">
77 <package pattern="*" />
78 </packageSource>
79 </packageSourceMapping>
80</configuration>
81EOF
82 } >NuGet.config
83}
84
85prepare() {
86 # The runtime packages are part of the source-built .NET of Arch Linux
87 # (dotnet-source-built-artifacts), which Arch Linux ARM doesn't have. It can't be a makedepends of
88 # an arch=any package, so it's used when it's installed, and they come from nuget.org otherwise.
89 mkdir -p nuget-local
90 local _artifacts
91 for _artifacts in /usr/share/dotnet/source-built-artifacts/Private.SourceBuilt.Artifacts.*.tar.gz; do
92 [[ -f "$_artifacts" ]] || continue
93 bsdtar -xf "$_artifacts" -C nuget-local "${_runtimepackages[@]/%/.*.nupkg}"
94 touch runtime-packages
95 done
96
97 cd "microsoft-authentication-library-for-dotnet-$_commit" || exit
98 # Upstream pins the .NET 8 SDK, the libraries build with newer ones just as well
99 rm global.json
100 # Upstream runs the unit tests on Windows only. They also target .NET Framework 4.8, which pulls in
101 # the Windows-only desktop projects, and deploy their resources with Windows paths.
102 # shellcheck disable=SC2016 # MSBuild properties, not shell expansions
103 sed -i 's|<TargetFrameworks>$(TargetFrameworkNetDesktop48);$(TargetFrameworkNet)</TargetFrameworks>|<TargetFrameworks>$(TargetFrameworkNet)</TargetFrameworks>|' \
104 tests/Microsoft.Identity.Test.Unit/Microsoft.Identity.Test.Unit.csproj
105 grep -rl --include='*.cs' 'DeploymentItem(' tests/Microsoft.Identity.Test.Unit |
106 xargs sed -i -E 's/DeploymentItem\((@?)"Resources\\\\?/DeploymentItem(\1"Resources\//'
107 _nuget_config
108}
109
110build() {
111 _dotnet_env
112 cd "microsoft-authentication-library-for-dotnet-$_commit" || exit
113 # On Linux, upstream's projects build for .NET Standard 2.0 and .NET 8, not the .NET Framework,
114 # Android and iOS builds. The assemblies are signed with the key in the repository, giving them the
115 # same strong names as upstream's.
116 local _package
117 for _package in "${_packages[@]}"; do
118 dotnet pack "src/client/$_package/$_package.csproj" "${_build_arguments[@]}" --output "$srcdir/nupkg"
119 done
120}
121
122check() {
123 _dotnet_env
124 cd "microsoft-authentication-library-for-dotnet-$_commit" || exit
125 # Tests of features and behaviour that only exist on Windows, which upstream doesn't run elsewhere:
126 local _filter=(
127 # Managed identity with mTLS proof of possession, which needs Windows CNG keys (KeyGuard), see
128 # https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/pull/5807
129 'FullyQualifiedName!~ManagedIdentityTests.ImdsV2Tests.'
130 'FullyQualifiedName!~ManagedIdentityTests.ManagedIdentityTests.GetManagedIdentityCapabilities_ImdsV2KeyGuard_ReportsKeyGuardAsync'
131 # The key provider for it uses CNG on .NET 8 regardless of the platform (#if NET8_0)
132 'FullyQualifiedName!~ManagedIdentityTests.InMemoryManagedIdentityKeyProviderTests.Cancellation_AfterCache_ReturnsCachedKey_IgnoringCancellation'
133 'FullyQualifiedName!~ManagedIdentityTests.InMemoryManagedIdentityKeyProviderTests.Cancellation_BeforeCreation_Throws_And_SubsequentCallSucceeds'
134 'FullyQualifiedName!~ManagedIdentityTests.InMemoryManagedIdentityKeyProviderTests.ReturnsRsa2048_AndCaches_Success'
135 'FullyQualifiedName!~ManagedIdentityTests.InMemoryManagedIdentityKeyProviderTests.Rsa_SignsAndVerifies'
136 # The broker is the Web Account Manager of Windows
137 'FullyQualifiedName!~BrokerTests.RuntimeBrokerTests.'
138 'FullyQualifiedName!~BrokerTests.BrokerTests.BrokerGetAccountsWithBrokerInstalledTestAsync'
139 # They expect Windows line endings in the serialized JSON
140 'FullyQualifiedName!~CacheSerializationTests.TestAppMetadata_Supports_AdditionalFields'
141 'FullyQualifiedName!~CacheSerializationTests.TestMsalNet2XCacheSerializationInterop'
142 'FullyQualifiedName!~CacheSerializationTests.TestSerializeMsalAccessTokenCacheItemWithAdditionalFields'
143 'FullyQualifiedName!~CacheSerializationTests.TestSerializeMsalAccountCacheItemWithAdditionalFields'
144 'FullyQualifiedName!~CacheSerializationTests.TestSerializeMsalIdTokenCacheItemWithAdditionalFields'
145 'FullyQualifiedName!~CacheSerializationTests.TestSerializeMsalRefreshTokenCacheItemWithAdditionalFields'
146 # It expects "Windows" as the OS in the telemetry headers
147 'FullyQualifiedName!~TelemetryTests.MsalIdHelperTests.IdHelperAsync'
148 # Setting an environment variable to an empty string only removes it on Windows
149 'FullyQualifiedName!~CoreTests.EnvVariableContextTests.EnvVariableContextTest'
150 # The file watcher raises two change events for touching a file on Linux (inotify)
151 'FullyQualifiedName!~CacheExtension.FileIOWithRetriesTests.Touch_FiresEvent_Async'
152 )
153 # The test runner targets .NET 8. The tests parse timestamps in the current culture and time zone,
154 # and expect the invariant culture and UTC like on upstream's CI.
155 TZ=UTC LC_ALL=C.UTF-8 DOTNET_ROLL_FORWARD=Major \
156 dotnet test tests/Microsoft.Identity.Test.Unit/Microsoft.Identity.Test.Unit.csproj \
157 "${_build_arguments[@]}" --filter "$(
158 IFS='&'
159 echo "${_filter[*]}"
160 )"
161}
162
163# Fails if a binary in $pkgdir, also inside the .nupkg files there, is identical to one of the packages
164# restored from a remote feed like nuget.org into $1, so no prebuilt binary slips in instead of one built
165# from source
166_check_prebuilt() {
167 local _extracted="$srcdir/check-prebuilt" _metadata _file _hash _found=0
168 local _binaries=(-type f '(' -name '*.dll' -o -name '*.exe' -o -name '*.so' -o -name '*.so.*' -o -name '*.dylib' ')')
169 local -A _prebuilt=()
170 while IFS= read -r -d '' _metadata; do
171 grep -qE '"source": *"https?://' "$_metadata" || continue
172 while IFS= read -r -d '' _file; do
173 _prebuilt[$(sha256sum <"$_file")]="${_file#"$1"/}"
174 done < <(find "${_metadata%/*}" "${_binaries[@]}" -print0)
175 done < <(find "$1" -name .nupkg.metadata -print0)
176
177 rm -rf "$_extracted"
178 mkdir -p "$_extracted"
179 while IFS= read -r -d '' _file; do
180 mkdir -p "$_extracted/${_file#"$pkgdir"/}"
181 bsdtar -xf "$_file" -C "$_extracted/${_file#"$pkgdir"/}"
182 done < <(find "$pkgdir" -type f -name '*.nupkg' -print0)
183 while IFS= read -r -d '' _file; do
184 _hash=$(sha256sum <"$_file")
185 if [[ -v "_prebuilt[$_hash]" ]]; then
186 echo "Prebuilt binary: ${_file#"$_extracted"/} is ${_prebuilt[$_hash]}" >&2
187 _found=1
188 fi
189 done < <(find "$pkgdir" "$_extracted" "${_binaries[@]}" -print0)
190 rm -rf "$_extracted"
191 return "$_found"
192}
193
194package() {
195 local _package
196 for _package in "${_packages[@]}"; do
197 install -Dm644 "$srcdir/nupkg/$_package.$pkgver.nupkg" -t "$pkgdir/usr/share/dotnet/nuget-packages/"
198 done
199 install -Dm644 "microsoft-authentication-library-for-dotnet-$_commit/LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname/"
200
201 _check_prebuilt "$srcdir/nuget"
202}
203

Scan history

Scanned at (UTC)SeverityRules
2026-10-31 05:57:59 Low 1

Report a package

Reports go to the AURWatch maintainer (one person) and are read by hand. No login required.

0 / 4000
Your suggestion