(Äldre) Apple SSO Cookbook (REST API V1) apple-sso-cookbook-rest-api-v1

IMPORTANT
Innehållet på den här sidan tillhandahålls endast i informationssyfte. Användning av denna API kräver en aktuell licens från Adobe. Ingen obehörig användning är tillåten.
IMPORTANT
Se till att du håller dig informerad om de senaste produktmeddelandena för Adobe Pass-autentisering och tidslinjer för avveckling som sammanställts på sidan Produktmeddelanden.

Adobe Pass Authentication REST API V1 har stöd för Partner Single Sign-On (SSO) för slutanvändare av klientprogram som körs på iOS, iPadOS eller tvOS.

Det här dokumentet fungerar som ett tillägg till den befintliga dokumentationen för REST API V1, som finns här.

Cookbook apple-sso-cookbook-rest-api-v1-cookbook

För att du ska kunna dra nytta av Apple SSO-användarupplevelsen måste programmet integrera det Video Subscriber Account Framework som utvecklats av Apple, och för Adobe Pass Authentication REST API V1-kommunikationen måste programmet följa stegen nedan.

Behörighet apple-sso-cookbook-rest-api-v1-permission

TIP
Pro Tips! Strömningsprogrammet måste begära åtkomst till användarens prenumerationsinformation som har sparats på enhetsnivå, och användaren måste ge programmet behörighet att fortsätta, på samma sätt som att ge åtkomst till enhetens kamera eller mikrofon. Den här behörigheten måste begäras per program med Apple Video Subscriber Account Framework och enheten sparar användarens val.
TIP
Pro Tips! Vi rekommenderar att du uppmuntrar användare som vägrar ge åtkomst till prenumerationsinformation genom att förklara fördelarna med Apple användarupplevelse med enkel inloggning, men tänk på att användaren kan ändra sitt beslut genom att gå till programinställningarna (åtkomst till tv-provider) eller till Settings -> TV Provider på iOS och iPadOS eller Settings -> Accounts -> TV Provider på tvOS.
TIP
Pro Tips! Vi rekommenderar att du begär användarens tillstånd när programmet försätts i förgrunden eftersom programmet kan kontrollera om användaren har behörighet att komma åt användarens prenumerationsinformation när som helst innan användarautentisering krävs.

Autentisering apple-sso-cookbook-rest-api-v1-authentication

Steg: "Finns det en giltig token för autentisering i Adobe?" step1

TIP
Tips! Implementera detta via Adobe Pass-autentiseringsmediet Kontrollera autentiseringstoken API-tjänsten.

Steg:"Är användaren inloggad via enkel inloggning för partner?" step2

TIP
Tips! Implementera detta via Video Subscriber Account Framework.
  • Programmet måste kontrollera om användaren har behörighet att komma åt användarens prenumerationsinformation och fortsätta endast om användaren tillåter det.
  • Programmet måste skicka en förfrågan för prenumerantkontoinformation.
  • Programmet måste vänta och bearbeta metadata-informationen.
TIP
Pro Tip: Följ kodfragmentet och observera kommentarerna extra.
...
let videoSubscriberAccountManager: VSAccountManager = VSAccountManager();

videoSubscriberAccountManager.checkAccessStatus(options: [VSCheckAccessOption.prompt: true]) { (accessStatus, error) -> Void in
            switch (accessStatus) {
            // The user allows the application to access subscription information.
            case VSAccountAccessStatus.granted:
                    // Construct the request for subscriber account information.
                    let vsaMetadataRequest: VSAccountMetadataRequest = VSAccountMetadataRequest();

                    // This is actually the SAML Issuer not the channel ID.
                    vsaMetadataRequest.channelIdentifier = "https://saml.sp.auth.adobe.com";

                    // This is the subscription account information needed at this step.
                    vsaMetadataRequest.includeAccountProviderIdentifier = true;

                    // This is the subscription account information needed at this step.
                    vsaMetadataRequest.includeAuthenticationExpirationDate = true;

                    // This is going to make the Video Subscriber Account Framework to refrain from prompting the user with the providers picker at this step.
                    vsaMetadataRequest.isInterruptionAllowed = false;

                    // Submit the request for subscriber account information - accountProviderIdentifier.
                    videoSubscriberAccountManager.enqueue(vsaMetadataRequest) { vsaMetadata, vsaError in
                        if (vsaMetadata != nil && vsaMetadata!.accountProviderIdentifier != nil) {
                            // The vsaMetadata!.authenticationExpirationDate will contain the expiration date for current authentication session.
                            // The vsaMetadata!.authenticationExpirationDate should be compared against current date.
                            ...
                            // The vsaMetadata!.accountProviderIdentifier will contain the provider identifier as it is known for the platform configuration.
                            // The vsaMetadata!.accountProviderIdentifier represents the platformMappingId in terms of Adobe Pass Authentication configuration.
                            ...
                            // The application must determine the MVPD id property value based on the platformMappingId property value obtained above.
                            // The application must use the MVPD id further in its communication with Adobe Pass Authentication services.
                            ...
                            // Continue with the "Obtain a profile request from Adobe for the selected MVPD" step.
                            ...
                            // Continue with the "Forward the Adobe request to Partner SSO to obtain the profile" step.
                            ...
                        } else {
                            // The user is not authenticated at platform level, continue with the "Fetch Adobe configuration" step.
                            ...
                        }
                    }

            // The user has not yet made a choice or does not allow the application to access subscription information.
            default:
                // Continue with the "Initiate regular authentication workflow" step.
                ...
            }
}
...

Steg: "Hämta Adobe-konfiguration" step3

TIP
Tips! Implementera detta via Adobe Pass-autentiseringen Tillhandahåll API-tjänsten MVPD List.
TIP
Pro Tip: Observera MVPD-egenskaperna: enablePlatformServices, boardingStatus, displayInPlatformPicker, platformMappingId, requiredMetadataFields och observera de kommentarer som presenteras i kodfragment från andra steg.

Steg"Initiera enkel inloggning för partner med Adobe config" step4

TIP
Tips! Implementera detta via Video Subscriber Account Framework.
  • Programmet måste kontrollera om användaren har behörighet att komma åt användarens prenumerationsinformation och fortsätta endast om användaren tillåter det.
  • Programmet måste tillhandahålla delegate för VSAccountManager.
  • Programmet måste skicka en förfrågan för prenumerantkontoinformation.
  • Programmet måste vänta och bearbeta metadata-informationen.
TIP
Pro Tip: Följ kodfragmentet och observera kommentarerna extra.
    ...
    let videoSubscriberAccountManager: VSAccountManager = VSAccountManager();

    // This must be a class implementing the VSAccountManagerDelegate protocol.
    let videoSubscriberAccountManagerDelegate: VideoSubscriberAccountManagerDelegate = VideoSubscriberAccountManagerDelegate();

    videoSubscriberAccountManager.delegate = videoSubscriberAccountManagerDelegate;

    videoSubscriberAccountManager.checkAccessStatus(options: [VSCheckAccessOption.prompt: true]) { (accessStatus, error) -> Void in
                switch (accessStatus) {
                // The user allows the application to access subscription information.
                case VSAccountAccessStatus.granted:
                        // Construct the request for subscriber account information.
                        let vsaMetadataRequest: VSAccountMetadataRequest = VSAccountMetadataRequest();

                        // This is actually the SAML Issuer not the channel ID.
                        vsaMetadataRequest.channelIdentifier = "https://saml.sp.auth.adobe.com";

                        // This is the subscription account information needed at this step.
                        vsaMetadataRequest.includeAccountProviderIdentifier = true;

                        // This is the subscription account information needed at this step.
                        vsaMetadataRequest.includeAuthenticationExpirationDate = true;

                        // This is going to make the Video Subscriber Account Framework to prompt the user with the providers picker at this step.
                        vsaMetadataRequest.isInterruptionAllowed = true;

                        // This can be computed from the [Adobe Pass Authentication](/docs/pass/authentication/provide-mvpd-list.md) service response in order to filter the TV providers from the Apple picker.
                        vsaMetadataRequest.supportedAccountProviderIdentifiers = supportedAccountProviderIdentifiers;

                        // This can be computed from the [Adobe Pass Authentication](/docs/pass/authentication/provide-mvpd-list.md) service response in order to sort the TV providers from the Apple picker.
                        if #available(iOS 11.0, tvOS 11, *) {
                            vsaMetadataRequest.featuredAccountProviderIdentifiers = featuredAccountProviderIdentifiers;
                        }

                        // Submit the request for subscriber account information - accountProviderIdentifier.
                        videoSubscriberAccountManager.enqueue(vsaMetadataRequest) { vsaMetadata, vsaError in
                            // This represents the checks for the "Is user login successful?" step.
                            if (vsaMetadata != nil && vsaMetadata!.accountProviderIdentifier != nil) {
                                // The vsaMetadata!.authenticationExpirationDate will contain the expiration date for current authentication session.
                                // The vsaMetadata!.authenticationExpirationDate should be compared against current date.
                                ...
                                // The vsaMetadata!.accountProviderIdentifier will contain the provider identifier as it is known for the platform configuration.
                                // The vsaMetadata!.accountProviderIdentifier represents the platformMappingId in terms of Adobe Pass Authentication configuration.
                                ...
                                // The application must determine the MVPD id property value based on the platformMappingId property value obtained above.
                                // The application must use the MVPD id further in its communication with Adobe Pass Authentication services.
                                ...
                                // Continue with the "Obtain a profile request from Adobe for the selected MVPD" step.
                                ...
                                // Continue with the "Forward the Adobe request to Partner SSO to obtain the profile" step.
                                ...
                            } else {
                                // The user is not authenticated at platform level.
                                if (vsaError != nil) {
                                    // The application can check to see if the user selected a provider which is present in Apple picker, but the provider is not onboarded in platform SSO.
                                    if let error: NSError = (vsaError! as NSError), error.code == 1, let appleMsoId = error.userInfo["VSErrorInfoKeyUnsupportedProviderIdentifier"] as! String? {
                                        var mvpd: Mvpd? = nil;

                                        // The requestor.mvpds must be computed during the "Fetch Adobe configuration" step.
                                        for provider in requestor.mvpds {
                                            if provider.platformMappingId == appleMsoId {
                                                mvpd = provider;
                                                break;
                                            }
                                        }

                                        if mvpd != nil {
                                            // Continue with the "Initiate regular authentication workflow" step, but you can skip prompting the user with your MVPD picker and use the mvpd selection, therefore creating a better UX.
                                            ...
                                        } else {
                                            // Continue with the "Initiate regular authentication workflow" step.
                                            ...
                                        }
                                    } else {
                                        // Continue with the "Initiate regular authentication workflow" step.
                                        ...
                                    }
                                } else {
                                    // Continue with the "Initiate regular authentication workflow" step.
                                    ...
                                }
                            }
                        }

                // The user has not yet made a choice or does not allow the application to access subscription information.
                default:
                    // Continue with the "Initiate regular authentication workflow" step.
                    ...
                }
    }
    ...

Steg:"Har användarinloggningen slutförts?" step5

TIP
Pro Tips! Observera kodfragmentet i "Starta enkel inloggning för partner med Adobe config" -steget. Användarinloggningen lyckas om vsaMetadata!.accountProviderIdentifier innehåller ett giltigt värde och det aktuella datumet inte har passerat värdet vsaMetadata!.authenticationExpirationDate.

Steg"Hämta en profilförfrågan från Adobe för den valda MVPD" step6

TIP
Tips! Implementera detta via API-tjänsten Profilbegäran för Adobe Pass-autentisering.
TIP
Pro Tips! Observera att den provider-identifierare som hämtas från Video Subscriber Account Framework representerar platformMappingId i form av Adobe Pass-autentiseringskonfiguration. Därför måste programmet fastställa egenskapsvärdet för MVPD-id med hjälp av värdet platformMappingId via API-tjänsten Adobe Pass Authentication Provide MVPD List .

Steg:"Vidarebefordra Adobe-begäran till enkel inloggning för partner för att erhålla profilen" step7

TIP
Tips! Implementera detta via Video Subscriber Account Framework.
  • Programmet måste kontrollera om användaren har behörighet att komma åt användarens prenumerationsinformation och fortsätta endast om användaren tillåter det.
  • Programmet måste skicka en förfrågan för prenumerantkontoinformation.
  • Programmet måste vänta och bearbeta metadata-informationen.
TIP
Pro Tip: Följ kodfragmentet och observera kommentarerna extra.
    ...
    let videoSubscriberAccountManager: VSAccountManager = VSAccountManager();

    videoSubscriberAccountManager.checkAccessStatus(options: [VSCheckAccessOption.prompt: true]) { (accessStatus, error) -> Void in
                switch (accessStatus) {
                // The user allows the application to access subscription information.
                case VSAccountAccessStatus.granted:
                        // Construct the request for subscriber account information.
                        let vsaMetadataRequest: VSAccountMetadataRequest = VSAccountMetadataRequest();

                        // This is actually the SAML Issuer not the channel ID.
                        vsaMetadataRequest.channelIdentifier = "https://saml.sp.auth.adobe.com";

                        // This is going to include subscription account information which should match the provider determined in a previous step.
                        vsaMetadataRequest.includeAccountProviderIdentifier = true;

                        // This is going to include subscription account information which should match the provider determined in a previous step.
                        vsaMetadataRequest.includeAuthenticationExpirationDate = true;

                        // This is going to make the Video Subscriber Account Framework to refrain from prompting the user with the providers picker at this step.
                        vsaMetadataRequest.isInterruptionAllowed = false;

                        // This are the user metadata fields expected to be available on a successful login and are determined from the [Adobe Pass Authentication](/docs/pass/authentication/provide-mvpd-list.md) service. Look for the requiredMetadataFields associated with the provider determined in a previous step.
                        vsaMetadataRequest.attributeNames = requiredMetadataFields;

                        // This is the payload from [Adobe Pass Authentication](/docs/pass/authentication/retrieve-profilerequest.md) service.
                        vsaMetadataRequest.verificationToken = profileRequestPayload;

                        // Submit the request for subscriber account information.
                        videoSubscriberAccountManager.enqueue(vsaMetadataRequest) { vsaMetadata, vsaError in
                            if (vsaMetadata != nil && vsaMetadata!.samlAttributeQueryResponse != nil) {
                                var samlResponse: String? = vsaMetadata!.samlAttributeQueryResponse!;

                                // Remove new lines, new tabs and spaces.
                                samlResponse = samlResponse?.replacingOccurrences(of: "[ \\t]+", with: " ", options: String.CompareOptions.regularExpression);
                                samlResponse = samlResponse?.components(separatedBy: CharacterSet.newlines).joined(separator: "");
                                samlResponse = samlResponse?.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines);

                                // Base64 encode.
                                samlResponse = samlResponse?.data(using: .utf8)?.base64EncodedString(options: []);

                                // URL encode. Please be aware not to double URL encode it further.
                                samlResponse = samlResponse?.addingPercentEncoding(withAllowedCharacters: CharacterSet.init(charactersIn: "!*'();:@&=+$,/?%#[]").inverted);

                                // Continue with the "Exchange the Partner SSO profile for an Adobe authentication token" step.
                                ...
                            } else {
                                // Continue with the "Initiate regular authentication workflow" step.
                                ...
                            }
                        }

                // The user has not yet made a choice or does not allow the application to access subscription information.
                default:
                    // Continue with the "Initiate regular authentication workflow" step.
                    ...
                }
    }
    ...

Steg:"Byt ut partnerns SSO-profil för en autentiseringstoken för Adobe" step8

TIP
Tips! Implementera detta via API-tjänsten för Adobe Pass-autentisering Token Exchange.
TIP
Pro Tips! Observera kodfragmentet från "Vidarebefordra Adobe-begäran till enkel inloggning för partner för att hämta profilen"-steget. Denna vsaMetadata!.samlAttributeQueryResponse! representerar SAMLResponse, som måste skickas på Token Exchange och som kräver strängmanipulering och kodning (Base64-kodad och URL-kodad efteråt) innan anropet görs.

Steg:"Har Adobe-token genererats utan fel?" step9

TIP
Tips! Implementera detta via Adobe Pass-autentiseringsmediet Token Exchange lyckades. Svaret blir 204 No Content, vilket anger att token skapades och är klar att användas för auktoriseringsflödena.

Steg:"Starta ett regelbundet autentiseringsarbetsflöde" step10

TIP
Tips! Implementera detta via Adobe Pass-autentisering Registreringskodbegäran, Initiera autentisering och Hämta autentiseringstoken eller Kontrollera autentiseringstoken API-tjänster.
TIP
Pro Tip: Följ stegen nedan för implementering/implementering av tvOS.
TIP
Pro Tips! Följ stegen nedan för implementering/implementering av iOS/iPadOS.

Steg:"Fortsätt med auktoriseringsflöden" step11

TIP
Tips! Implementera detta via Adobe Pass-autentiseringen Initiera auktorisering och Hämta API-tjänster för Short Media Token.

Utloggning apple-sso-cookbook-rest-api-v1-logout

Video Subscriber Account Framework innehåller inget API för att programmässigt logga ut personer som har loggat in på sitt TV-leverantörskonto på enhetssystemnivå. För att utloggningen ska få full effekt måste slutanvändaren därför uttryckligen logga ut från Settings -> TV Provider på iOS/iPadOS eller Settings -> Accounts -> TV Provider på tvOS. Det andra alternativet som användaren skulle ha möjlighet att återkalla behörigheten att få åtkomst till användarens prenumerationsinformation från det specifika avsnittet för programinställningar (TV-leverantörsåtkomst).

TIP
Tips! Implementera detta via Adobe Pass-autentiseringen Anrop av användarmetadata och Logout API-tjänster.
TIP
Pro Tip: Följ stegen nedan för implementering/implementering av tvOS.
  • Programmet måste avgöra om autentiseringen har skett som ett resultat av en inloggning via partnerns SSO eller inte, med hjälp av tokenSource användarens metadata från Adobe Pass-autentiseringstjänsten.
  • Programmet måste instruera/uppmana användaren att explicit logga ut från Settings -> Accounts -> TV Provider på tvOS only om värdet "tokenSource" är lika med Apple".
  • Programmet måste initiera utloggningen från Adobe Pass-autentiseringstjänsten med ett direkt HTTP-anrop. Detta underlättar inte sessionssanering på MVPD sida.
TIP
Pro Tips! Följ stegen nedan för implementering/implementering av iOS/iPadOS.
  • Programmet måste avgöra om autentiseringen har skett som ett resultat av en inloggning via partnerns SSO eller inte, med hjälp av tokenSource användarens metadata från Adobe Pass-autentiseringstjänsten.
  • Programmet måste instruera/uppmana användaren att explicit logga ut från Settings -> TV Provider på iOS/iPadOS only om värdet "tokenSource" är lika med "Apple".
  • Programmet måste initiera utloggningen från Adobe Pass-autentiseringstjänsten med en WKWebView eller en SFSafariViewController -komponent. Detta underlättar sessionssanering på MVPD sida.
recommendation-more-help
3f5e655c-af63-48cc-9769-2b6803cc5f4b