| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT license. |
| 3 | |
| 4 | /* |
| 5 | Package wstrust provides a client for communicating with a WSTrust (https://en.wikipedia.org/wiki/WS-Trust#:~:text=WS%2DTrust%20is%20a%20WS,in%20a%20secure%20message%20exchange.) |
| 6 | for the purposes of extracting metadata from the service. This data can be used to acquire |
| 7 | tokens using the accesstokens.Client.GetAccessTokenFromSamlGrant() call. |
| 8 | */ |
| 9 | package wstrustscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/ |
| 10 | |
| 11 | import ( |
| 12 | "contextscip-go gomod github.com/golang/go/src go1.18 context/" |
| 13 | "errorsscip-go gomod github.com/golang/go/src go1.18 errors/" |
| 14 | "fmtscip-go gomod github.com/golang/go/src go1.18 fmt/" |
| 15 | "net/httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/" |
| 16 | "net/urlscip-go gomod github.com/golang/go/src go1.18 `net/url`/" |
| 17 | |
| 18 | "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authorityscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority`/" |
| 19 | "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/grantscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/grant`/" |
| 20 | "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defsscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/" |
| 21 | ) |
| 22 | |
| 23 | type xmlCallerscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/xmlCaller# interface { |
| 24 | XMLCallscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/xmlCaller#XMLCall.(ctx contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, endpoint string, headers httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#, qv urlscip-go gomod github.com/golang/go/src go1.18 `net/url`/.Valuesscip-go gomod github.com/golang/go/src go1.18 `net/url`/Values#, resp interface{}) error |
| 25 | SOAPCallscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/xmlCaller#SOAPCall.(ctx contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, endpoint, action string, headers httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#, qv urlscip-go gomod github.com/golang/go/src go1.18 `net/url`/.Valuesscip-go gomod github.com/golang/go/src go1.18 `net/url`/Values#, body string, resp interface{}) error |
| 26 | } |
| 27 | |
| 28 | type SamlTokenInfoscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo# struct { |
| 29 | AssertionTypescip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#AssertionType. string // Should be either constants SAMLV1Grant or SAMLV2Grant. |
| 30 | Assertionscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#Assertion. string |
| 31 | } |
| 32 | |
| 33 | // Client represents the REST calls to get tokens from token generator backends. |
| 34 | type Clientscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/Client# struct { |
| 35 | // Comm provides the HTTP transport client. |
| 36 | Commscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/Client#Comm. xmlCallerscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/xmlCaller# |
| 37 | } |
| 38 | |
| 39 | // TODO(msal): This allows me to call Mex without having a real Def file on line 45. |
| 40 | // This would fail because policies() would not find a policy. This is easy enough to |
| 41 | // fix in test data, but.... Definitions is defined with built in structs. That needs |
| 42 | // to be pulled apart and until then I have this hack in. |
| 43 | var newFromDefscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/newFromDef. = defsscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/.NewFromDefscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/NewFromDef(). |
| 44 | |
| 45 | // Mex provides metadata about a wstrust service. |
| 46 | func (c Clientscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/Client#) Mexscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/Client#Mex().(ctx contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, federationMetadataURL string) (defsscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/.MexDocumentscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/MexDocument#, error) { |
| 47 | resp := defsscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/.Definitionsscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/Definitions#{} |
| 48 | err := c.Commscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/Client#Comm..XMLCallscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/xmlCaller#XMLCall.( |
| 49 | ctx, |
| 50 | federationMetadataURL, |
| 51 | httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#{}, |
| 52 | nil, |
| 53 | &resp, |
| 54 | ) |
| 55 | if err != nil { |
| 56 | return defsscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/.MexDocumentscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/MexDocument#{}, err |
| 57 | } |
| 58 | |
| 59 | return newFromDefscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/newFromDef.(resp) |
| 60 | } |
| 61 | |
| 62 | const ( |
| 63 | SoapActionDefaultscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SoapActionDefault. = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue" |
| 64 | |
| 65 | // Note: Commented out because this action is not supported. It was in the original code |
| 66 | // but only used in a switch where it errored. Since there was only one value, a default |
| 67 | // worked better. However, buildTokenRequestMessage() had 2005 support. I'm not actually |
| 68 | // sure what's going on here. It like we have half support. For now this is here just |
| 69 | // for documentation purposes in case we are going to add support. |
| 70 | // |
| 71 | // SoapActionWSTrust2005 = "http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue" |
| 72 | ) |
| 73 | |
| 74 | // SAMLTokenInfo provides SAML information that is used to generate a SAML token. |
| 75 | func (c Clientscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/Client#) SAMLTokenInfoscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/Client#SAMLTokenInfo().(ctx contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, authParameters authorityscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority`/.AuthParamsscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority`/AuthParams#, cloudAudienceURN string, endpoint defsscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/.Endpointscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/Endpoint#) (SamlTokenInfoscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#, error) { |
| 76 | var wsTrustRequestMessage string |
| 77 | var err error |
| 78 | |
| 79 | switch authParameters.AuthorizationTypescip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority`/AuthParams#AuthorizationType. { |
| 80 | case authorityscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority`/.ATWindowsIntegratedscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority`/ATWindowsIntegrated.: |
| 81 | wsTrustRequestMessage, err = endpoint.BuildTokenRequestMessageWIAscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/Endpoint#BuildTokenRequestMessageWIA().(cloudAudienceURN) |
| 82 | if err != nil { |
| 83 | return SamlTokenInfoscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#{}, err |
| 84 | } |
| 85 | case authorityscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority`/.ATUsernamePasswordscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority`/ATUsernamePassword.: |
| 86 | wsTrustRequestMessage, err = endpoint.BuildTokenRequestMessageUsernamePasswordscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/Endpoint#BuildTokenRequestMessageUsernamePassword().( |
| 87 | cloudAudienceURN, authParameters.Usernamescip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority`/AuthParams#Username., authParameters.Passwordscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority`/AuthParams#Password.) |
| 88 | if err != nil { |
| 89 | return SamlTokenInfoscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#{}, err |
| 90 | } |
| 91 | default: |
| 92 | return SamlTokenInfoscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#{}, fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.18 fmt/Errorf().("unknown auth type %v", authParameters.AuthorizationTypescip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority`/AuthParams#AuthorizationType.) |
| 93 | } |
| 94 | |
| 95 | var soapAction string |
| 96 | switch endpoint.Versionscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/Endpoint#Version. { |
| 97 | case defsscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/.Trust13scip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/Trust13.: |
| 98 | soapAction = SoapActionDefaultscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SoapActionDefault. |
| 99 | case defsscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/.Trust2005scip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/Trust2005.: |
| 100 | return SamlTokenInfoscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#{}, errorsscip-go gomod github.com/golang/go/src go1.18 errors/.Newscip-go gomod github.com/golang/go/src go1.18 errors/New().("WS Trust 2005 support is not implemented") |
| 101 | default: |
| 102 | return SamlTokenInfoscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#{}, fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.18 fmt/Errorf().("the SOAP endpoint for a wstrust call had an invalid version: %v", endpoint.Versionscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/Endpoint#Version.) |
| 103 | } |
| 104 | |
| 105 | resp := defsscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/.SAMLDefinitionsscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/SAMLDefinitions#{} |
| 106 | err = c.Commscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/Client#Comm..SOAPCallscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/xmlCaller#SOAPCall.(ctx, endpoint.URLscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/Endpoint#URL., soapAction, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#{}, nil, wsTrustRequestMessage, &resp) |
| 107 | if err != nil { |
| 108 | return SamlTokenInfoscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#{}, err |
| 109 | } |
| 110 | |
| 111 | return c.samlAssertionscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/Client#samlAssertion().(resp) |
| 112 | } |
| 113 | |
| 114 | const ( |
| 115 | samlv1Assertionscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/samlv1Assertion. = "urn:oasis:names:tc:SAML:1.0:assertion" |
| 116 | samlv2Assertionscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/samlv2Assertion. = "urn:oasis:names:tc:SAML:2.0:assertion" |
| 117 | ) |
| 118 | |
| 119 | func (c Clientscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/Client#) samlAssertionscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/Client#samlAssertion().(def defsscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/.SAMLDefinitionsscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/SAMLDefinitions#) (SamlTokenInfoscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#, error) { |
| 120 | for _, tokenResponse := range def.Bodyscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/SAMLDefinitions#Body..RequestSecurityTokenResponseCollectionscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/Body#RequestSecurityTokenResponseCollection..RequestSecurityTokenResponsescip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/RequestSecurityTokenResponseCollection#RequestSecurityTokenResponse. { |
| 121 | token := tokenResponse.RequestedSecurityTokenscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/RequestSecurityTokenResponse#RequestedSecurityToken. |
| 122 | if token.Assertionscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/RequestedSecurityToken#Assertion..XMLNamescip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/Assertion#XMLName..Localscip-go gomod github.com/golang/go/src go1.18 `encoding/xml`/Name#Local. != "" { |
| 123 | assertion := token.AssertionRawXMLscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/RequestedSecurityToken#AssertionRawXML. |
| 124 | |
| 125 | samlVersion := token.Assertionscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/RequestedSecurityToken#Assertion..Samlscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs`/Assertion#Saml. |
| 126 | switch samlVersion { |
| 127 | case samlv1Assertionscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/samlv1Assertion.: |
| 128 | return SamlTokenInfoscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#{AssertionTypescip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#AssertionType.: grantscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/grant`/.SAMLV1scip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/grant`/SAMLV1., Assertionscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#Assertion.: assertion}, nil |
| 129 | case samlv2Assertionscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/samlv2Assertion.: |
| 130 | return SamlTokenInfoscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#{AssertionTypescip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#AssertionType.: grantscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/grant`/.SAMLV2scip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/grant`/SAMLV2., Assertionscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#Assertion.: assertion}, nil |
| 131 | } |
| 132 | return SamlTokenInfoscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#{}, fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.18 fmt/Errorf().("couldn't parse SAML assertion, version unknown: %q", samlVersion) |
| 133 | } |
| 134 | } |
| 135 | return SamlTokenInfoscip-go gomod github.com/AzureAD/microsoft-authentication-library-for-go . `github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust`/SamlTokenInfo#{}, errorsscip-go gomod github.com/golang/go/src go1.18 errors/.Newscip-go gomod github.com/golang/go/src go1.18 errors/New().("unknown WS-Trust version") |
| 136 | } |