-
Notifications
You must be signed in to change notification settings - Fork 372
Imdsv2: Generate CSR and execute CSR request #5427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Robbie-Microsoft
wants to merge
21
commits into
rginsburg/msiv2_feature_branch
Choose a base branch
from
rginsburg/msiv2_csr
base: rginsburg/msiv2_feature_branch
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5498968
Initial commit. 2 TODOs
Robbie-Microsoft e04e408
Merge branch 'rginsburg/msiv2_feature_branch' into rginsburg/msiv2_csr
Robbie-Microsoft 4e096b7
Merge branch 'rginsburg/msiv2_feature_branch' into rginsburg/msiv2_csr
Robbie-Microsoft 6bc2164
Implemented CSR generator
Robbie-Microsoft 762ccdf
first pass at improved unit tests
Robbie-Microsoft 4ea6c09
Finished improving unit tests
Robbie-Microsoft 009f948
Updates to CUID
Robbie-Microsoft 21d4ef3
Unit test improvements
Robbie-Microsoft cd013a3
Implemented Feedback
Robbie-Microsoft 480ae9e
renamed file
Robbie-Microsoft 0aa8692
small improvement
Robbie-Microsoft 621c566
added missing awaitor for async method
Robbie-Microsoft 068461b
Fixed bugs discovered from unit testing in child branch
Robbie-Microsoft 2034b25
undid changes to .proj
Robbie-Microsoft 2b7486a
undid change to global.json
Robbie-Microsoft 189ff9e
added missing sets
Robbie-Microsoft 92b325f
Inplemented some feedback
Robbie-Microsoft 067c83c
Implemented some feedback
Robbie-Microsoft f7d6f88
PKCS1 -> Pss padding
Robbie-Microsoft 74e8e60
re-used imports
Robbie-Microsoft 152f396
Implemented feedback
Robbie-Microsoft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
src/client/Microsoft.Identity.Client/ManagedIdentity/ClientCredentialRequestResponse.cs
This file contains hidden or 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,53 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#if SUPPORTS_SYSTEM_TEXT_JSON | ||
using JsonProperty = System.Text.Json.Serialization.JsonPropertyNameAttribute; | ||
#else | ||
using Microsoft.Identity.Client.Utils; | ||
using Microsoft.Identity.Json; | ||
#endif | ||
|
||
namespace Microsoft.Identity.Client.ManagedIdentity | ||
{ | ||
/// <summary> | ||
/// Represents the response for a Managed Identity CSR request. | ||
/// </summary> | ||
internal class ClientCredentialRequestResponse | ||
{ | ||
[JsonProperty("client_id")] | ||
public string ClientId { get; set; } | ||
|
||
[JsonProperty("tenant_id")] | ||
public string TenantId { get; set; } | ||
|
||
[JsonProperty("client_credential")] | ||
Robbie-Microsoft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public string ClientCredential { get; set; } | ||
|
||
[JsonProperty("regional_token_url")] | ||
public string RegionalTokenUrl { get; set; } | ||
|
||
[JsonProperty("expires_in")] | ||
public int ExpiresIn { get; set; } | ||
|
||
[JsonProperty("refresh_in")] | ||
public int RefreshIn { get; set; } | ||
|
||
public ClientCredentialRequestResponse() { } | ||
|
||
public static bool ValidateCsrRequestResponse(ClientCredentialRequestResponse clientCredentialRequestResponse) | ||
Robbie-Microsoft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
if (string.IsNullOrEmpty(clientCredentialRequestResponse.ClientId) || | ||
string.IsNullOrEmpty(clientCredentialRequestResponse.TenantId) || | ||
string.IsNullOrEmpty(clientCredentialRequestResponse.ClientCredential) || | ||
string.IsNullOrEmpty(clientCredentialRequestResponse.RegionalTokenUrl) || | ||
clientCredentialRequestResponse.ExpiresIn <= 0 || | ||
clientCredentialRequestResponse.RefreshIn <= 0) | ||
{ | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.