File tree Expand file tree Collapse file tree
Kerberos.NET/Entities/Krb Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44// -----------------------------------------------------------------------
55
66using System ;
7- using System . Linq ;
87using Kerberos . NET . Asn1 ;
98
109namespace Kerberos . NET . Entities
@@ -17,42 +16,5 @@ public KrbEncTicketPart DecodeAsApplication(ReadOnlyMemory<byte> data)
1716 {
1817 return DecodeApplication ( data ) ;
1918 }
20-
21- public bool TryGetPac ( out PrivilegedAttributeCertificate pac )
22- {
23- pac = null ;
24-
25- KrbAuthorizationData adIfRelevantEntry = this . AuthorizationData ? . FirstOrDefault ( ad => ad . Type == AuthorizationDataType . AdIfRelevant ) ;
26- if ( adIfRelevantEntry == null )
27- {
28- return false ;
29- }
30-
31- KrbAuthorizationDataSequence adIfRelevant = null ;
32- try
33- {
34- adIfRelevant = KrbAuthorizationDataSequence . Decode ( adIfRelevantEntry . Data ) ;
35- }
36- catch
37- {
38- return false ;
39- }
40-
41- KrbAuthorizationData pacEntry = adIfRelevant ? . AuthorizationData ? . First ( ad => ad . Type == AuthorizationDataType . AdWin2kPac ) ;
42- if ( pacEntry == null )
43- {
44- return false ;
45- }
46-
47- try
48- {
49- pac = new PrivilegedAttributeCertificate ( pacEntry ) ;
50- return true ;
51- }
52- catch
53- {
54- return false ;
55- }
56- }
5719 }
5820}
Original file line number Diff line number Diff line change 1+ // -----------------------------------------------------------------------
2+ // Licensed to The .NET Foundation under one or more agreements.
3+ // The .NET Foundation licenses this file to you under the MIT license.
4+ // -----------------------------------------------------------------------
5+
6+ using System . Linq ;
7+
8+ namespace Kerberos . NET . Entities
9+ {
10+ public static class KrbExtensions
11+ {
12+ public static bool TryGetPac ( this KrbEncTicketPart encTicketPart , out PrivilegedAttributeCertificate pac )
13+ {
14+ pac = null ;
15+
16+ KrbAuthorizationData adIfRelevantEntry = encTicketPart . AuthorizationData ? . FirstOrDefault ( ad => ad . Type == AuthorizationDataType . AdIfRelevant ) ;
17+ if ( adIfRelevantEntry == null )
18+ {
19+ return false ;
20+ }
21+
22+ KrbAuthorizationDataSequence adIfRelevant = null ;
23+ try
24+ {
25+ adIfRelevant = KrbAuthorizationDataSequence . Decode ( adIfRelevantEntry . Data ) ;
26+ }
27+ catch
28+ {
29+ return false ;
30+ }
31+
32+ KrbAuthorizationData pacEntry = adIfRelevant ? . AuthorizationData ? . First ( ad => ad . Type == AuthorizationDataType . AdWin2kPac ) ;
33+ if ( pacEntry == null )
34+ {
35+ return false ;
36+ }
37+
38+ try
39+ {
40+ pac = new PrivilegedAttributeCertificate ( pacEntry ) ;
41+ return true ;
42+ }
43+ catch
44+ {
45+ return false ;
46+ }
47+ }
48+ }
49+ }
You can’t perform that action at this time.
0 commit comments