Skip to content

Commit b7fe45f

Browse files
committed
removed unused code.
1 parent 1426fc8 commit b7fe45f

File tree

2 files changed

+35
-46
lines changed

2 files changed

+35
-46
lines changed

apps/confidential/confidential.go

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,6 @@ func (cca Client) AcquireTokenByUsernamePassword(ctx context.Context, scopes []s
668668
// acquireTokenByAuthCodeOptions contains the optional parameters used to acquire an access token using the authorization code flow.
669669
type acquireTokenByAuthCodeOptions struct {
670670
challenge, claims, tenantID string
671-
extraBodyParameters map[string]string
672671
}
673672

674673
// AcquireByAuthCodeOption is implemented by options for AcquireTokenByAuthCode
@@ -702,23 +701,22 @@ func WithChallenge(challenge string) interface {
702701
// AcquireTokenByAuthCode is a request to acquire a security token from the authority, using an authorization code.
703702
// The specified redirect URI must be the same URI that was used when the authorization code was requested.
704703
//
705-
// Options: [WithChallenge], [WithClaims], [WithTenantID]]
704+
// Options: [WithChallenge], [WithClaims], [WithTenantID]
706705
func (cca Client) AcquireTokenByAuthCode(ctx context.Context, code string, redirectURI string, scopes []string, opts ...AcquireByAuthCodeOption) (AuthResult, error) {
707706
o := acquireTokenByAuthCodeOptions{}
708707
if err := options.ApplyOptions(&o, opts); err != nil {
709708
return AuthResult{}, err
710709
}
711710

712711
params := base.AcquireTokenAuthCodeParameters{
713-
Scopes: scopes,
714-
Code: code,
715-
Challenge: o.challenge,
716-
Claims: o.claims,
717-
AppType: accesstokens.ATConfidential,
718-
Credential: cca.cred, // This setting differs from public.Client.AcquireTokenByAuthCode
719-
RedirectURI: redirectURI,
720-
TenantID: o.tenantID,
721-
ExtraBodyParameters: o.extraBodyParameters,
712+
Scopes: scopes,
713+
Code: code,
714+
Challenge: o.challenge,
715+
Claims: o.claims,
716+
AppType: accesstokens.ATConfidential,
717+
Credential: cca.cred, // This setting differs from public.Client.AcquireTokenByAuthCode
718+
RedirectURI: redirectURI,
719+
TenantID: o.tenantID,
722720
}
723721

724722
return cca.base.AcquireTokenByAuthCode(ctx, params)
@@ -788,8 +786,7 @@ func (cca Client) AcquireTokenByCredential(ctx context.Context, scopes []string,
788786

789787
// acquireTokenOnBehalfOfOptions contains optional configuration for AcquireTokenOnBehalfOf
790788
type acquireTokenOnBehalfOfOptions struct {
791-
claims, tenantID string
792-
extraBodyParameters map[string]string
789+
claims, tenantID string
793790
}
794791

795792
// AcquireOnBehalfOfOption is implemented by options for AcquireTokenOnBehalfOf
@@ -807,12 +804,11 @@ func (cca Client) AcquireTokenOnBehalfOf(ctx context.Context, userAssertion stri
807804
return AuthResult{}, err
808805
}
809806
params := base.AcquireTokenOnBehalfOfParameters{
810-
Scopes: scopes,
811-
UserAssertion: userAssertion,
812-
Claims: o.claims,
813-
Credential: cca.cred,
814-
TenantID: o.tenantID,
815-
ExtraBodyParameters: o.extraBodyParameters,
807+
Scopes: scopes,
808+
UserAssertion: userAssertion,
809+
Claims: o.claims,
810+
Credential: cca.cred,
811+
TenantID: o.tenantID,
816812
}
817813
return cca.base.AcquireTokenOnBehalfOf(ctx, params)
818814
}

apps/internal/base/base.go

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,22 @@ type AcquireTokenSilentParameters struct {
6565
// Code challenges are used to secure authorization code grants; for more information, visit
6666
// https://tools.ietf.org/html/rfc7636.
6767
type AcquireTokenAuthCodeParameters struct {
68-
Scopes []string
69-
Code string
70-
Challenge string
71-
Claims string
72-
RedirectURI string
73-
AppType accesstokens.AppType
74-
Credential *accesstokens.Credential
75-
TenantID string
76-
ExtraBodyParameters map[string]string
68+
Scopes []string
69+
Code string
70+
Challenge string
71+
Claims string
72+
RedirectURI string
73+
AppType accesstokens.AppType
74+
Credential *accesstokens.Credential
75+
TenantID string
7776
}
7877

7978
type AcquireTokenOnBehalfOfParameters struct {
80-
Scopes []string
81-
Claims string
82-
Credential *accesstokens.Credential
83-
TenantID string
84-
UserAssertion string
85-
ExtraBodyParameters map[string]string
79+
Scopes []string
80+
Claims string
81+
Credential *accesstokens.Credential
82+
TenantID string
83+
UserAssertion string
8684
}
8785

8886
// AuthResult contains the results of one token acquisition operation in PublicClientApplication
@@ -412,10 +410,6 @@ func (b Client) AcquireTokenByAuthCode(ctx context.Context, authCodeParams Acqui
412410
authParams.Redirecturi = authCodeParams.RedirectURI
413411
authParams.AuthorizationType = authority.ATAuthCode
414412

415-
if authCodeParams.ExtraBodyParameters != nil {
416-
authParams.ExtraBodyParameters = authCodeParams.ExtraBodyParameters
417-
}
418-
419413
var cc *accesstokens.Credential
420414
if authCodeParams.AppType == accesstokens.ATConfidential {
421415
cc = authCodeParams.Credential
@@ -439,14 +433,13 @@ func (b Client) AcquireTokenByAuthCode(ctx context.Context, authCodeParams Acqui
439433
func (b Client) AcquireTokenOnBehalfOf(ctx context.Context, onBehalfOfParams AcquireTokenOnBehalfOfParameters) (AuthResult, error) {
440434
var ar AuthResult
441435
silentParameters := AcquireTokenSilentParameters{
442-
Scopes: onBehalfOfParams.Scopes,
443-
RequestType: accesstokens.ATConfidential,
444-
Credential: onBehalfOfParams.Credential,
445-
UserAssertion: onBehalfOfParams.UserAssertion,
446-
AuthorizationType: authority.ATOnBehalfOf,
447-
TenantID: onBehalfOfParams.TenantID,
448-
Claims: onBehalfOfParams.Claims,
449-
ExtraBodyParameters: onBehalfOfParams.ExtraBodyParameters,
436+
Scopes: onBehalfOfParams.Scopes,
437+
RequestType: accesstokens.ATConfidential,
438+
Credential: onBehalfOfParams.Credential,
439+
UserAssertion: onBehalfOfParams.UserAssertion,
440+
AuthorizationType: authority.ATOnBehalfOf,
441+
TenantID: onBehalfOfParams.TenantID,
442+
Claims: onBehalfOfParams.Claims,
450443
}
451444
ar, err := b.AcquireTokenSilent(ctx, silentParameters)
452445
if err == nil {

0 commit comments

Comments
 (0)