-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
90 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,27 @@ | ||
# adfs-metadata | ||
Simple service to load and parse metadata from ADFS 3.0 metadata endpoint | ||
# ADFS Metadata Parser | ||
It is a pack of simple utilities to load and parse ADFS metadata. Parser was tested on ADFS 3.0. | ||
|
||
## Installing | ||
|
||
``` | ||
Install-Package DrWatson.Adfs.Metadata | ||
``` | ||
|
||
## Usage | ||
|
||
``` | ||
AdfsMetadataServiceAsync svc = new AdfsMetadataServiceAsync(() => | ||
{ | ||
return new HttpClient().GetStringAsync( | ||
"https://fs.example.com/FederationMetadata/2007-06/FederationMetadata.xml" | ||
); | ||
}); | ||
// Exception can be thrown | ||
await svc.Load(); | ||
if(svc.Ready) | ||
{ | ||
X509Certificate2 signingCert = svc.SigningCertificate(); | ||
string identity = svc.Identity; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
using System.Security.Cryptography.X509Certificates; | ||
|
||
namespace DrWatson.Adfs.Metadata | ||
{ | ||
public class AdfsMetadata | ||
{ | ||
public string Identity { get; set; } | ||
public string SigningCertificateString { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
using System.Security.Cryptography.X509Certificates; | ||
|
||
namespace DrWatson.Adfs.Metadata | ||
{ | ||
public static class AdfsMetadataExtensions | ||
{ | ||
public static X509Certificate2 GetSigningCertificate(this AdfsMetadata obj) => new X509Certificate2(Convert.FromBase64String(obj.SigningCertificateString)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters