Configurare l'autenticazione basata sulle attestazioni tramite Windows Live ID (SharePoint Foundation 2010)

 

Si applica a: SharePoint Foundation 2010

Ultima modifica dell'argomento: 2016-11-30

Con l'autenticazione basata sulle attestazioni in Microsoft SharePoint Foundation 2010 è possibile delegare l'autenticazione al servizio token di sicurezza di Windows Live ID. Questa opportunità è importante se si desidera implementare uno scenario in cui viene utilizzato Windows Live ID per la gestione delle password. Il servizio Windows Live ID viene configurato come provider di identità per SharePoint Foundation 2010. Tra SharePoint Foundation 2010 e il servizio Windows Live ID viene stabilita una relazione di trust unidirezionale basata sui certificati. Quando un utente specifica credenziali Windows Live ID, il servizio Windows Live ID restituisce un PUID (Passport Unique Identity) e informazioni di posta elettronica incapsulati in un token delle attestazioni SAML (Security Assertion Markup Language) versione 1.1. La chiave pubblica di Windows Live ID, che fa parte del codice XML dei metadati di Windows Live ID, crittografa questo token delle attestazioni.

Per ulteriori informazioni su Windows Live ID, fare riferimento alle risorse seguenti:

Il cookie di Windows Live ID viene memorizzato nella cache nel computer client e inviato a SharePoint Foundation 2010 mediante una risposta POST a una richiesta di autenticazione eseguita correttamente. SharePoint Foundation 2010 converte il token SAML di Windows Live ID in un token SAML di SharePoint Foundation 2010. Il PUID dell'utente viene generato in base all'attestazione del nome dell'identità utente (UPN, User Principal Name) restituita nel token SAML. Questo valore viene utilizzato in SharePoint Foundation 2010 per identificare in modo univoco l'utente e controllare l'accesso. SharePoint Foundation 2010 può incrementare i token degli utenti con ulteriori attestazioni utilizzando un provider di attestazioni personalizzato, configurato nell'applicazione Web di SharePoint Foundation 2010. Il cookie di SharePoint Foundation 2010 viene restituito al computer client e memorizzato nella cache per richieste successive. Quando il cookie di Windows Live ID o SharePoint Foundation 2010 scade, l'utente viene reindirizzato a un server di Windows Live ID.

Contenuto dell'articolo:

-
Configurare il servizio token di sicurezza di Windows Live ID

-
Configurare SharePoint per l'autenticazione di Windows Live ID

-
Convertire un ambiente interno Windows Live ID in un ambiente di produzione

-
Creare tipi diversi di applicazioni Web di SharePoint basate sulle attestazioni

-
Concedere autorizzazioni a tutti gli utenti autenticati di Windows Live ID

Configurare il servizio token di sicurezza di Windows Live ID

Il protocollo WS-Federation viene implementato dal servizio Windows Live ID e fornisce l'infrastruttura del servizio token di sicurezza di Live ID designato come provider di identità attendibile. È possibile estrarre un certificato pubblico di Windows Live ID da un nodo X509Certificate XML dei metadati e salvarlo in un certificato di sicurezza Internet con estensione di file cer. Se il codice XML dei metadati include più nodi X509Certificate, è possibile utilizzare uno di essi. Fornire l'accesso in lettura all'account del pool di applicazioni della farm di SharePoint Foundation 2010 in un certificato di sicurezza Internet (file con estensione cer).

Configurare Microsoft Services Manager (MSM) utilizzando i valori seguenti:

Valore Descrizione

Domain Name

Nome di dominio per cui verranno generate le richieste di autenticazione per il servizio token di sicurezza di Live ID. Utilizzare un nome di dominio completo (FQDN).

Default Return URL

URL a cui verrà reindirizzato un utente da parte del servizio token di sicurezza di Windows Live ID dopo un'autenticazione eseguita correttamente, ad esempio: https://username.global.corp.contoso.com/_trust/default.aspx.

DNS Name

Identificatore univoco fornito in una richiesta di autenticazione al servizio token di sicurezza di Windows Live ID. Questo identificatore univoco abilita la funzionalità di ricerca per Default Return URL. Il nome DNS deve corrispondere al valore dell'area di autenticazione specificato nella richiesta di autenticazione di Windows Live ID.

WRealm Parameter

Il parametro WRealm deve corrispondere al campo DNS nella configurazione del sito di MSM. Questo parametro deve essere creato utilizzando uno dei formati seguenti: sotto.dominio.principale o Urn:dominio:nome.

Override Authentication Policy

Configurare questo criterio utilizzando il valore seguente: MBI_FED_SSL.

Configurare SharePoint per l'autenticazione di Windows Live ID

Eseguire le procedure illustrate in questa sezione per configurare SharePoint Foundation 2010 per l'autenticazione di Windows Live ID.

Per configurare SharePoint per l'autenticazione di Windows Live ID tramite Windows PowerShell

  1. Verificare che vengano soddisfatti i requisiti minimi seguenti: vedere Add-SPShellAdmin.

  2. Fare clic sul pulsante Start e scegliere Tutti i programmi.

  3. Fare clic su Prodotti Microsoft SharePoint 2010.

  4. Fare clic su Shell di gestione SharePoint 2010.

  5. Al prompt dei comandi di Windows PowerShell (ovvero PS C:\>) definire il valore dell'area di autenticazione corrispondente al valore di DNS Name specificato in Microsoft Services Manager. Il valore dell'area di autenticazione nell'integrazione di Windows Live ID deve corrispondere al nome DNS corretto, come illustrato nell'esempio seguente:

    $realm = "urn:" + $env:ComputerName + ":ServerName"
    
  6. Ottenere il valore PUID dell'account che verrà utilizzato come account dell'amministratore della farm eseguendo innanzitutto l'accesso al sito Web seguente: Windows Live ID(https://accountservices.passport.net/?ru=https://accountservices.passport.net/Credentials.srf%3Fvv%3D750%26mkt%3DIT-IT%26lc%3D1040\&vv=750\&mkt=IT-IT\&lc=1040\&id=10) e quindi individuando il campo Unique ID nella pagina delle credenziali.

  7. Specificare il valore PUID utilizzando il formato seguente: PUID@live.com.

  8. Individuare uno dei nodi <X509Certificate> nell'origine seguente: URL XML dei metadati (https://nexus.passport-int.com/federationmetadata2/2007-06/federationmetadata.xml).

  9. Copiare il contenuto di uno dei due nodi X509Certificate, come illustrato nell'esempio seguente:

    MIICWzCCAcSgAwIBAgIJAJEzHoaEodSoMA0GCSqGSIb3DQEBBQUAMCkxJzAlBgNV
    BAMTHkxpdmUgSUQgU1RTIFNpZ25pbmcgUHVibGljIEtleTAeFw0wODEwMzAyMjA5
    MjNaFw0xMzEwMjkyMjA5MjNaMCkxJzAlBgNVBAMTHkxpdmUgSUQgU1RTIFNpZ25p
    bmcgUHVibGljIEtleTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArz97XPae
    GNAC4UnKl5zReyhgk3Bzf08U+CgD0R9+GZOahmpakJXFpI213gQWiHrUGaMN9nsK
    4kzSfDPiquAMsV6vBYyWuPLZ0XrMzTAOV/WHSK3bCsYWWQZeH9Xn8G1Hkz+gQSC/
    92lBbq9oBCZfLv3OlkobOmT8d+ldRKGU4pUCAwEAAaOBijCBhzAdBgNVHQ4EFgQU
    VbJyIcGL0AjB4/Wm4DqUZux6uUkwWQYDVR0jBFIwUIAUVbJyIcGL0AjB4/Wm4DqU
    Zux6uUmhLaQrMCkxJzAlBgNVBAMTHkxpdmUgSUQgU1RTIFNpZ25pbmcgUHVibGlj
    IEtleYIJAJEzHoaEodSoMAsGA1UdDwQEAwIBxjANBgkqhkiG9w0BAQUFAAOBgQAO
    /5vGfu+Vg1TKBuxsAIMqjqKXX7aRrANNZM/5ACdwAUtMDG/n8INoXgOKr851fbF6
    4yBesmFjg2TbR8y0/ITAD+d+iyEpR7IO3/is9rWAj4ggbw8yqaDWn26eh3bAdoa+
    p38qtqJHkUGF5vApeHiu6zO573bKs+nXcKVM8mNbjA==
    
  10. Incollare il contenuto di uno dei nodi X509Certificate in un nuovo file del Blocco note e salvarlo utilizzando il nome di file seguente: LiveID-INT.cer.

  11. Configurare il certificato di Windows Live ID (estratto dal codice XML dei metadati), come illustrato nell'esempio seguente:

    $certloc = "C:\LiveIDWithSAML\LiveID-INT.cer"
    
  12. Definire una nuova autorità radice attendibile in SharePoint Foundation 2010, come illustrato nell'esempio seguente:

    $rootcert = Get-PfxCertificate $certloc
    New-SPTrustedRootAuthority "NewRootAuthority" -Certificate $rootcert | Out-Null
    
  13. Creare un oggetto con un certificato di Windows Live ID, come illustrato nell'esempio seguente:

    $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($certloc)
    
  14. Definire l'attestazione che verrà utilizzata come identificatore univoco dell'utente. Eseguire il mapping dell'attestazione UPN con l'ID del nome di attestazione riservato. È inoltre possibile eseguire il mapping dell'attestazione dell'indirizzo di posta elettronica, come illustrato nell'esempio seguente:

    $map1 = New-SPClaimTypeMapping -IncomingClaimType "https://schemas.xmlsoap.org/claims/EmailAddress" -IncomingClaimTypeDisplayName "https://schemas.xmlsoap.org/claims/EmailAddress" -SameAsIncoming
    $map2 = New-SPClaimTypeMapping -IncomingClaimType "https://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier" -IncomingClaimTypeDisplayName "UPN" -LocalClaimType "https://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn"
    
  15. Creare un nuovo provider di autenticazione di SharePoint Foundation 2010 per una nuova applicazione Web, come illustrato nell'esempio seguente:

    $apSAML = New-SPTrustedIdentityTokenIssuer -Name "LiveID" -Description "LiveID" -Realm $realm -ImportTrustCertificate $cert -ClaimsMappings $map1,$map2 -SignInUrl "https://login.live-int.com/login.srf" -IdentifierClaim "https://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"
    
  16. Creare una nuova applicazione Web di SharePoint Foundation 2010 da utilizzare con il provider di autenticazione creato al passaggio precedente, come illustrato nell'esempio seguente:

    $waurl = https://" + $env:ComputerName - You might use FQDN url of your site here.
    $title = "Site Title"
    $waexe = New-SPWebApplication -Name $title -ApplicationPool $title -ApplicationPoolAccount $owner -Url $waurl -AuthenticationProvider
    $scexe = New-SPSite $siteurl -Name $title -Description $title -Template 'STS#1' -OwnerAlias
    
  17. Avviare Gestione Internet Information Services (IIS) digitando INETMGR al prompt dei comandi.

  18. Passare al sito dell'applicazioneWeb basata sulle attestazioni in IIS.

  19. Nel riquadro sinistro fare clic con il pulsante destro del mouse sull'applicazionee scegliere Modifica binding.

  20. Selezionare https e fare clic su Modifica.

  21. In Certificato SSL selezionare un certificato in elenco. Valutare la possibilità di utilizzare un certificato autofirmato.

  22. Importare il certificato pubblico di Windows Live ID nelle cartelle Computer locale, SharePoint Foundation 2010 e Persone attendibili.

Convertire un ambiente interno Windows Live ID in un ambiente di produzione

Eseguire le procedure illustrate in questa sezione per convertire un ambiente interno Windows Live ID in un ambiente di produzione.

Per convertire un ambiente interno Windows Live ID in un ambiente di produzione

  1. Verificare che sia stata effettuata la migrazione del sito a un ambiente di produzione in MSM e che vengano soddisfatti tutti i requisiti di conformità. Non è necessario verificare la conformità se l'ambiente Windows Live ID in MSM è interno.

  2. Verificare che il criterio di autenticazione dell'ambiente di produzione Windows Live ID sia configurato con il valore seguente: MBI_FED_SSL.

  3. Verificare che nell'ambiente di produzione Windows Live ID vengano utilizzati URL basati su HTTPS, poiché il criterio di autenticazione dell'ambiente di produzione è configurato per il trasporto SSL. I siti dell'ambiente di produzione inviano richieste POST su SSL a https://login.live.com/. In SPTrustedIdentityTokenIssuer è presente un URI del provider che deve corrispondere all'URI di accesso attivo. Accertarsi che l'URI di accesso attivo sia basato su HTTPS.

  4. Se il provider di attestazioni di Windows Live ID è configurato per l'utilizzo di un indirizzo di posta elettronica anziché di un PUID, il sito dell'ambiente di produzione deve essere incluso nel gruppo di criteri Microsoft. Considerare che questo gruppo di criteri viene approvato automaticamente per i partner interni, mentre per i partner esterni è necessaria l'approvazione esplicita.

Creare tipi diversi di applicazioni Web di SharePoint basate sulle attestazioni

Eseguire le procedure illustrate in questa sezione per utilizzare uno script di Windows PowerShell per la creazione di tipi diversi di applicazioni Web di SharePoint Foundation 2010 basate sulle attestazioni.

Per creare tipi diversi di applicazioni Web di SharePoint basate sulle attestazioni tramite Windows PowerShell

  1. Verificare che vengano soddisfatti i requisiti minimi seguenti: vedere Add-SPShellAdmin.

  2. Fare clic sul pulsante Start e scegliere Tutti i programmi.

  3. Scegliere Prodotti Microsoft SharePoint 2010.

  4. Scegliere Shell di gestione SharePoint 2010.

  5. Al prompt dei comandi di Windows PowerShell eseguire lo script DeployLiveIdWithSAML, come illustrato nell'esempio seguente:

    #.SYNOPSIS
    #    Script for creating different types of claims web applications from the Windows PowerShell command line.
    #.DESCRIPTION
    #    Script will create ANON, WIN, FBA, MULTI, MIXED, SAML and combinations of these web applications.
    #.NOTES
    #    Script: ClaimsWA.ps1
    #    Remark: The script will load/unload additional snap-ins depending on where it's being executed from.
    #    Update: 1/15/2010 (v2.0)
    #.PARAMETER type
    #   Indicates the type of claims web app to create (see examples for full list of valid supported types)
    #If not specified, this will default to ALL and each of the supported types of claims web apps will be created
    #.PARAMETER port
    #   Indicates the port number to create the web app on (See reserved ports at https://support.microsoft.com/kb/832017)
    #If not specified, this will default to port 201 and will be incremented in sequence for multiple web apps
    #.PARAMETER owner
    #   Indicates the domain account that will be used for App Pool (should be registered as a SharePoint Server managed account)
    #If not specified, this will default to logged on user and will use USERDOMAIN & USERNAME environment values
    #.EXAMPLE
    #   claimswa.ps1 WIN (create WIN-claims web app at port# 201 and use logged on user for app pool account)
    #   Here are some more examples of HOWTO use the script:
    #      claimswa.ps1 ANON (create ANON web app at port# 201)
    #      claimswa.ps1 ANON/FBA 701 (create ANON/FBA web app at port# 701)
    #      claimswa.ps1 FBA (create FBA web app at port# 201 using LDAP provider; default is REDMOND instance)
    #      claimswa.ps1 FBA/IBM (create FBA web app at port# 201 using LDAP provider pointing to the IBM instance)
    #      claimswa.ps1 FBA/SQL 851 (create forms-based authentication web app at port# 851 using SQL provider)
    #      claimswa.ps1 WIN/FBA/MIXED 501 (create Windows/forms-based authentication mixed-mode web apps at port# 501)
    #      claimswa.ps1 WIN/SAML/MULTI 901 (create Windows/SAML multi-auth web apps at port# 901)
    #   Here is the full list of all the support TYPEs (combine options delimited with slash for your config):
    #   Basic auth types:
    #      WIN   : create Windows claims web application on the port# specified on command line
    #      FBA   : create forms-based authentication claims web apps with the specified membership provider (SQL Server/LDAP listed below)
    #      SAML  : create SAML-claims web application on the default HTTPS port# 443
    #      ANON  : indicator switch for creating the web application to allow ANON mode
    #   Complex auth types:
    #      MULTI : create claims web application with multiple auth types using a single URL to access
    #      MIXED : create claims web application with multiple auth types using multiple URLs to access
    #   FBA membership/rolemanager providers
    #      RED   : use the REDMOND domain LDAP provider; this is the default setting if a provider is not specified
    #      SQL   : use the SQL Server provider for connecting to forms-based authentication web apps (connects to the ASPNETDB instance on ZADANG)
    #      PPL   : use the PEOPLEDC domain LDAP provider that is a private domain used for testing PEOPLE features
    #      SUN   : use the SUNOne LDAP provider in the PEOPLEDC domain which is used for profile import/sync testing
    #      IBM   : use the IBM LDAP provider in the PEOPLEDC domain which is used for profile import/sync testing
    #      NVL   : use the Novell LDAP provider in the PEOPLEDC domain which is used for profile import/sync testing
    
    # TODO (no specific ETA for these updates):
    #    1. Set the default IIS cert bindings for SAML web
    #    2. Use IIS CMDlets instead of updating XML object
    #    3. We should be able to define MixedMode base auth
    #    4. Use the domain for logged on user for LDAP string
    #    5. Do not attempt to write to CA/STS if running on WFE
    
    
    # Define the args list that we will accept & work with
    param ([string]$type, [int]$port, [string]$owner)
    
    function main() {
        # Valid options list
        $auths  = @("WIN", "FBA", "SAML", "ANON")
        $extnd  = @("MULTI", "MIXED")
        $provs  = @("SQL", "RED", "PPL", "SUN", "IBM", "NVL")
        $optns  = @("APP", "FIX")
        $typeOK = $true
    
        # Do we have the minimum args data before we can proceed
        # I'm not doing extensive validation but at least minimum
        foreach ($arg in $type.split("/")) {
            if (($auths+$extnd+$optns+$provs) -notcontains $arg) {
                write-host -Fore Red "`nInvalid TYPE argument was specified; execution aborted!`nTo see a list of valid TYPEs, execute with -examples option`n"
                $typeOK=$false; break
            }
        }
    
        if ($typeOK) {
            $type = @($type.toupper().split("/") | Sort | Get-Unique)
            switch ($type.count) {
                1 {
                    foreach ($arg in $type) {
                        if (($auths+$extnd+$optns) -notcontains $arg) {
                            write-host -Fore Red "`nInvalid AUTH argument was specified; execution aborted!`nTo see a list of valid AUTHs, execute with -examples option`n"
                            $typeOK=$false; break
                        }
                    }
                    if (($type -eq "MULTI") -or ($type -eq "MIXED")) {
                        $type += @("WIN", "FBA"); write-host -Fore Yellow "MULTI/MIXED auth combo not specified; defaulting to $type"
                    }
                    if ($type -eq "ANON") {
                        $type += @("WIN"); write-host -Fore Yellow "ANON auth combo not specified; defaulting to $type"
                    }
                }
    
                2 {
                    if ($type -contains "ANON") {
                        foreach ($arg in $type) {
                            if ($auths -notcontains $arg) {
                                write-host -Fore Red "`nInvalid ANON combo was specified; execution aborted!`nTo see a list of valid PROVIDERs, execute with -examples option`n"
                                $typeOK=$false; break
                            }
                        }
                    }
                    else {
                        $multiOK=$true
                        foreach ($arg in $type) {
                            if ($auth -notcontains $arg) {
                                $multiOK=$false; break
                            }
                        }
                        if ($multiOK) {$type += @("MULTI"); write-host -Fore Yellow "Multiple auth types specified; defaulting to $type"}
                    }
                }
            }
    
            if (($type -contains "MULTI") -or ($type -contains "MIXED") -and ($type.count -lt 3)) {
                write-host -Fore Red "`nMULTI/MIXED option requires 2 base auth types be specified!`nTo see a list of valid TYPEs, execute with -examples option`n"
                $typeOK=$false
            }
        }
    
        if ($typeOK) {
            # We seem to have the TYPE argument, let's check the others
    
            if (-not $port) {
                if ($type -contains "SAML") {$port=443} else {$port=201}
                write-host -Fore Yellow "PORT not specified; defaulting to $port"
            }
    
            if (-not $owner) {
                $owner = $env:UserDomain + "\" + $env:UserName.tolower()
                write-host -Fore Yellow "OWNER not specified; defaulting to $owner"
            }
    
            #In case somebody attempts to execute this script in the regular PS/ISE console,
            #let's load the IIS/SP snap-in to ensure we have everything we need to work with
            Manage-SnapIns (1)
    
            # check what flavor of SERVER we're running
            $product = Get-SPProduct | Where-Object {$_.ProductName.contains("SharePoint Server 2010")};
            if ($product.ProductName.contains("Debug")) {$flavor="DEBUG"} else {$flavor="SHIP"}
            write-host -Fore Green "Detected $flavor flavor of MOSS installed on this farm!"
    
            if ($type -contains "APP") {
                Write-WEBConfigs 0 "APP"
            }
            elseif ($type -contains "FIX") {
                Fix-Environment
            }
            else {
                Create-WebApp $type $port
            }
    
            # We're done with the snap-ins, so let's unload them
            Manage-SnapIns (0)
        }
    }
    
    function Fix-Environment {
        # This is just a series of steps to clean up
        # Not recommended to use unless you know why!
        Remove-SPTrustedRootAuthority NewRootAuthority
        Remove-SPTrustedIdentityTokenIssuer ServerName
    
        # I need to add the other clean up stuff here...
    }
    
    # This is the core script block that creates the different web apps
    function Create-WebApp ([string]$type, [int]$port) {
        $waurl = http://" + $env:ComputerName
    
        if ($type.contains("SAML")) { $waurl = $waurl.replace("http", "https") }
        $siteurl = $waurl + ":" + $port
        $title = "ClaimsWA-$port-" + $type.replace(" ","-")
    
        # Let's construct the WA/SC CMDlet call that we'll invoke later
        $waexe = "New-SPWebApplication -Name $title -ApplicationPool $title -ApplicationPoolAccount $owner -Url $waurl -AuthenticationProvider"
        $scexe = "New-SPSite $siteurl -Name $title -Description $title -Template 'STS#1' -OwnerAlias"
    
        write-host -Fore Cyan "`nSetting up $title on port $port now:"
    
        if ($type.contains("WIN")) {
            $apWIN = New-SPAuthenticationProvider -DisableKerberos:$true
            $cpWIN = New-SPClaimsPrincipal -Identity $owner -IdentityType 1
        }
    
        if ($type.contains("FBA")) {
            if ($type.contains("SQL")) {
                $membership="SQLms"; $rolemanager="SQLrm"; $identity = "sqlms:user1"
            }
            elseif ($type.contains("PPL")) {
                $membership="PPLms"; $rolemanager="PPLrm"; $identity = "pplms:fbauser1"
            }
            elseif ($type.contains("SUN")) {
                $membership="SUNms"; $rolemanager="SUNrm"; $identity = "sunms:fbauser1"
            }
            elseif ($type.contains("IBM")) {
                $membership="IBMms"; $rolemanager="IBMrm"; $identity = "ibmms:fbauser1"
            }
            elseif ($type.contains("NVL")) {
                $membership="NVLms"; $rolemanager="NVLrm"; $identity = "nvlms:fbauser1"
            }
            else {
                $membership="REDms"; $rolemanager="REDrm"; $identity = ("redms:$env:UserName").tolower()
            }
    
            $apFBA = New-SPAuthenticationProvider -ASPNETMembershipProvider $membership -ASPNETRoleProviderName $rolemanager;
            $cpFBA = New-SPClaimsPrincipal -Identity $identity -IdentityType 4
        }
    
        if ($type.contains("SAML")) {                
            $realm = "urn:" + $env:ComputerName + ":ServerName"
            $user  = "000300008448E34D@live.com" 
            $certloc = "C:\LiveIDWithSAML\LiveID-INT.cer"
    
            $rootcert = Get-PfxCertificate $certloc
            New-SPTrustedRootAuthority "NewRootAuthority" -Certificate $rootcert | Out-Null
    
           $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($certloc)
           $map1 = New-SPClaimTypeMapping -IncomingClaimType "https://schemas.xmlsoap.org/claims/EmailAddress" -IncomingClaimTypeDisplayName "https://schemas.xmlsoap.org/claims/EmailAddress" -SameAsIncoming
           $map2 = New-SPClaimTypeMapping -IncomingClaimType "https://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier" -IncomingClaimTypeDisplayName "UPN" -LocalClaimType "https://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn"
    
           $apSAML = New-SPTrustedIdentityTokenIssuer -Name "LiveID" -Description "LiveID" -Realm $realm -ImportTrustCertificate $cert -ClaimsMappings $map1,$map2 -SignInUrl "https://login.live-int.com/login.srf" -IdentifierClaim "https://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"
           $cpSAML = New-SPClaimsPrincipal -TrustedIdentityTokenIssuer $apSAML -Identity $user.tolower()
        }
    
        if ($type.contains("WIN")) {
            $waexe += " `$apWIN"; $scexe += " `$cpWIN.ToEncodedString()"
        }
        elseif ($type.contains("FBA")) {
            $waexe += " `$apFBA"; $scexe += " `$cpFBA.ToEncodedString()"
        }
        else {
            $waexe += " `$apSAML -SecureSocketsLayer"; $scexe += " `$cpSAML.ToEncodedString()"
        }
    
        if ($type.contains("MULTI")) {
            if ($type.contains("WIN")) {
                if ($type.contains("FBA")) {
                    $waexe += ",`$apFBA"; $scexe += " -SecondaryOwnerAlias `$cpFBA.ToEncodedString()"
                }
                if ($type.contains("SAML")) {
                    $waexe += ",`$apSAML -SecureSocketsLayer"; if (!$scexe.contains("Secondary")) { $scexe += " -SecondaryOwnerAlias `$cpSAML.ToEncodedString()" }
                }
            }
            else {
                $waexe += ",`$apSAML -SecureSocketsLayer"; $scexe += " -SecondaryOwnerAlias `$cpSAML.ToEncodedString()"
            }
        }
    
        # Check if we're creating the ANON web apps
        if ($type.contains("ANON")) { $waexe += " -AllowAnonymousAccess" }
    
        $waexe += " -Port $port | Out-Null"; $scexe += " | Out-Null"
    
        write-host -Fore Cyan "Deploying app..." -noNewLine
        Invoke-Expression $waexe
    
        # We could do this with a simple if/else but there may be other auth types too
        if ($type.contains("WIN"))  { Create-UserPolicy $siteurl $cpWIN.ToEncodedString()  }
        if ($type.contains("FBA"))  { Create-UserPolicy $siteurl $cpFBA.ToEncodedString()  }
        if ($type.contains("SAML")) { Create-UserPolicy $siteurl $cpSAML.ToEncodedString() }
    
        write-host -Fore Cyan "Creating site..." -noNewLine
        Invoke-Expression $scexe
    
        # If this is the ANON web app, then set the root site access to entire web
        if ($type.contains("ANON")) { $web = Get-SPWeb $siteurl; $web.AnonymousState="On"; $web.Update() }
    
        # At this time, let's also check if it's going to be a MixedMode web app
        if ($type.contains("MIXED")) {
            # If it's a Mixed-Mode web app we need to extend the base app to another auth type too
            $port++; write-host -Fore Cyan "Extending port $port..." -noNewLine
            $waurl = $waurl.replace("https", "http")
            $waexe = "Get-SPWebApplication $siteurl | New-SPWebApplicationExtension -Name $title-Ext -Zone `"Intranet`" -URL $waurl -Port $port -AuthenticationProvider"
            if ($type.contains("WIN")) {
                if ($type.contains("FBA")) { $waexe += " `$apFBA" } else { $waexe += " `$apSAML" }
            }
            else {
                $waexe += " `$apSAML"
            }
            Invoke-Expression $waexe
        }
    
        # If we've created a FBA web app, then it's time to update the CA/STS/FBA web.config files
        if ($type.contains("FBA")) { Write-WEBConfigs 0 $port.tostring() }; write-host -Fore Cyan "done!"
    }
    
    function Create-UserPolicy ([string]$weburl, [string]$encodeduser) {
        $webapp = Get-SPWebApplication $weburl
        $policy = $webapp.Policies.Add($encodeduser, "ClaimsWA.ps1 User")
        $role = $webapp.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl)
        $policy.PolicyRoleBindings.Add($role)
        $webapp.Update()
    }
    
    function Write-WEBConfigs ([int]$begin, [string]$vroot) {
        # For now I'm using the XML object to load/save the config files
        # Eventually we should use the IIS:CMDlets from WebAdministration
    
        write-host -Fore Cyan "Writing WEBConfig..." -noNewLine
        #$filei = "\\back\scratch\suntoshs\backup\webconfigs.xml"
        $filei = "\\back\scratch\suntoshs\scripts\oobinstall\webconfigs.xml"
    
        $xmli = [xml](get-content $filei)
        $root = $xmli.get_DocumentElement()
    
        for ($j=$begin; $j -le 2; $j++) {
            if ($j -eq 0) {
                [void][reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint")
                $fileo = [Microsoft.SharePoint.Administration.SPAdministrationWebApplication]::Local.IisSettings.get_Item(0).Path.FullName + "\web.config"
            }
            elseif ($j -eq 1) {
                $fileo = $env:CommonProgramFiles + "\Microsoft Shared\Web Server Extensions\14\WebServices\SecurityToken\web.config"
                if ($flavor -eq "DEBUG") { $fileo = $fileo.replace("Shared", "Shared Debug") }
            }
            else {
                if ($vroot -ne "APP") { $fileo = $env:HomeDrive + "\inetpub\wwwroot\wss\VirtualDirectories\$vroot\web.config" }
            }
    
            $xmlo = [xml](get-content $fileo)
            $perf = $xmlo.CreateElement("clear")
    
            if ($flavor -eq "DEBUG") {
                $ship = $root.config[1].tokens.token[0].value
                $debug = $root.config[1].tokens.token[1].value
                $token = $root.config[0]["system.web"].membership.providers.add[0].type
                $root.config[0]["system.web"].membership.providers.add[0].SetAttribute("type", $token.replace($ship,$debug)) | Out-Null
                $token = $root.config[0]["system.web"].rolemanager.providers.add[0].type
                $root.config[0]["system.web"].rolemanager.providers.add[0].SetAttribute("type", $token.replace($ship,$debug)) | Out-Null
            }
    
            if ($j -eq 0) {
                # Update the CA web config
                if (-not $xmlo.SelectSingleNode("/configuration/connectionStrings")) {
                    $xmlo.configuration["system.web"].membership.ParentNode.RemoveChild($xmlo.configuration["system.web"].membership) | Out-Null
                    $xmlo.configuration["system.web"].roleManager.ParentNode.RemoveChild($xmlo.configuration["system.web"].roleManager) | Out-Null
                    $xmlo.SelectSingleNode("/configuration").AppendChild($xmlo.ImportNode($root.config[0]["connectionStrings"], $true)) | Out-Null
                    $xmlo.SelectSingleNode("/configuration/system.web").AppendChild($xmlo.ImportNode($root.config[0]["system.web"].membership, $true)) | Out-Null
                    $xmlo.SelectSingleNode("/configuration/system.web/membership/providers").PrependChild($xmlo.ImportNode($perf, $true)) | Out-Null
                    $xmlo.SelectSingleNode("/configuration/system.web").AppendChild($xmlo.ImportNode($root.config[0]["system.web"].rolemanager, $true)) | Out-Null
                    $xmlo.SelectSingleNode("/configuration/system.web/roleManager/providers").PrependChild($xmlo.ImportNode($perf, $true)) | Out-Null
                }
            }
            elseif ($j -eq 1) {
                # Update the STS web config
                if (-not $xmlo.SelectSingleNode("/configuration/system.web")) {
                    $xmlo.SelectSingleNode("/configuration").AppendChild($xmlo.ImportNode($root.config[0]["connectionStrings"], $true)) | Out-Null
                    $xmlo.SelectSingleNode("/configuration").AppendChild($xmlo.ImportNode($root.config[0]["system.web"], $true)) | Out-Null
                }
            }
            else {
                # Update the FBA web config
                if ($vroot -ne "APP") {
                    if ($type.contains("PPL")) {$provider=1} elseif ($type.contains("SUN")) {$provider=2} elseif ($type.contains("IBM")) {$provider=3} elseif ($type.contains("NVL")) {$provider=4} elseif ($type.contains("SQL")) {$provider=5} else {$provider=0}
                    $xmlo.SelectSingleNode("/configuration").AppendChild($xmlo.ImportNode($root.config[0]["connectionStrings"], $true)) | Out-Null
                    $xmlo.SelectSingleNode("/configuration/system.web/membership/providers").PrependChild($xmlo.ImportNode($root.config[0]["system.web"].membership.providers.add[$provider], $true)) | Out-Null
                    $xmlo.SelectSingleNode("/configuration/system.web/membership/providers").PrependChild($xmlo.ImportNode($perf, $true)) | Out-Null
                    $xmlo.SelectSingleNode("/configuration/system.web/roleManager/providers").PrependChild($xmlo.ImportNode($root.config[0]["system.web"].rolemanager.providers.add[$provider], $true)) | Out-Null
                    $xmlo.SelectSingleNode("/configuration/system.web/roleManager/providers").PrependChild($xmlo.ImportNode($perf, $true)) | Out-Null
                }
            }
            $xmlo.Save($fileo)
        }
    }
    
    function Manage-SnapIns ([int]$action) {
        #The OWSTimer process always causes an update conflict (known bug) while
        #creating multiple web apps; let's temporarily shut it down until we're done
    
        if ($action -eq 1) { Stop-Service "SPTimerV4" }
    
        # We need to do this only if we're running on ISE so check it
        if ($host.name.contains("ISE")) {
            if ($action -eq 1) {
                write-host -Fore Yellow "Detecting host and loading dependent snap-ins..."
                # Add-PSSnapIn WebAdministration (later!)
                Add-PSSnapIn Microsoft.Sharepoint.PowerShell
            }
            else {
                write-host -Fore Yellow "Unloading dependent snap-ins loaded earlier on..."
                # Remove-PSSnapIn WebAdministration (later!)
                Remove-PSSnapIn Microsoft.Sharepoint.PowerShell
            }
        }
        if ($action -eq 0) {Start-Service "SPTimerV4"; write-host -Fore Yellow "`nAll done; if there were errors please research PS database for known issues!`n"}
    }
    
    main
    
  6. Avviare Gestione Internet Information Services (IIS) digitando INETMGR al prompt dei comandi.

  7. Passare al sito dell'applicazioneWeb basata sulle attestazioni in IIS.

  8. Nel riquadro sinistro fare clic con il pulsante destro del mouse sull'applicazionee scegliere Modifica binding.

  9. Selezionare https e fare clic su Modifica.

  10. In Certificato SSL selezionare un certificato in elenco. Valutare la possibilità di utilizzare un certificato autofirmato.

  11. Importare il certificato pubblico di Windows Live ID nelle cartelle Computer locale, SharePoint Foundation 2010 e Persone attendibili.

  12. Eseguire IIS reset e individuare l'URL del sito.

Concedere autorizzazioni a tutti gli utenti autenticati di Windows Live ID

Eseguire le procedure illustrate in questa sezione per concedere autorizzazioni a tutti gli utenti autenticati di Windows Live ID.

Per concedere autorizzazioni a tutti gli utenti autenticati di Windows Live ID

  1. Individuare il sito di SharePoint Foundation 2010 creato e accedere utilizzando l'account Administrator.

  2. Scegliere Impostazioni sito dal menu Azioni sito.

  3. Nella sezione Utenti e autorizzazioni fare clic su Autorizzazioni sito.

  4. Fare clic sul gruppo Visitatori di nome sito, dove nome sito indica il nome del sito.

  5. Fare clic su Nuovo e quindi su Aggiungi utenti.

  6. Nella finestra Concedi autorizzazioni fare clic sull'icona Sfoglia.

  7. Nella finestra Seleziona utenti e gruppi fare clic su Tutti gli utenti e quindi su Tutti gli utenti (LiveIDSTS) nel riquadro destro.

  8. Fare clic su Aggiungi.

  9. Fare clic su OK.

  10. Verificare che ora Tutti gli utenti (LiveIDSTS) faccia parte del gruppo dei visitatori. A questo punto dovrebbe essere possibile effettuare l'accesso al sito di SharePoint Foundation 2010 con le credenziali di qualsiasi altro utente di Live ID.

Informazioni sull'autore

Birendra Acharya è Senior Software Design Engineer per MSIT presso Microsoft.

See Also

Other Resources

Informazioni su WS-Federation (https://go.microsoft.com/fwlink/?linkid=192377&clcid=0x410) (le informazioni potrebbero essere in lingua inglese)