KNF:Scoping: verschil tussen versies

Uit Kennisnet Developers Documentatie
Naar navigatie springen Naar zoeken springen
Regel 15: Regel 15:
   
 
//' Create the AuthnRequest//
 
//' Create the AuthnRequest//
// Private Function CreateAuthnRequest(certificate As X509Certificate2, ssoURL As String, UseScoping as Boolean, Brin as String) As XmlElement//
+
Private Function CreateAuthnRequest(certificate As X509Certificate2, ssoURL As String, UseScoping as Boolean, Brin as String) As XmlElement
   
 
' Define EntityID
 
' Define EntityID

Versie van 25 apr 2017 14:43

Scoping maakt het mogelijk dat een Service Provider een lijst van Identity Providers opgeeft in een authnRequest. Hiermee kan je als Service Provider bepalen welke Identity Providers ondersteund worden.

Indien je 1 Identity Provider gebruikt, wordt ook het het WAYF (inlog)scherm wordt overgeslagen. Deze functie is vooral handig indien je voor scholen een aparte omgeving / subdomein hebt.

Scoping met SimpleSAMLphp

Meer informatie daarover kan je op deze website vinden:

https://simplesamlphp.org/docs/stable/simplesamlphp-scoping

Scoping met componentspace

Toevoegen van scoping aan componentspace AuthnRequest()

    //' Create the AuthnRequest//
 Private Function CreateAuthnRequest(certificate As X509Certificate2, ssoURL As String, UseScoping as Boolean, Brin as String) As XmlElement

        ' Define EntityID
        Dim entityId As String = ConfigurationManager.AppSettings("Entree.EntityID")
        Dim authnRequest As New AuthnRequest()
        authnRequest.Destination = ssoURL
        authnRequest.Issuer = New Issuer(entityId)
        authnRequest.ForceAuthn = False
        authnRequest.NameIDPolicy = New NameIDPolicy(Nothing, Nothing, True)

        'Gebruik scoping om school selectie scherm over te slaan?
        If UseScoping = True Then

            'download json van kennisnet waar de ProviderIDs in zitten
            Dim wc As New WebClient()
            Dim json As String = wc.DownloadString(https://aselect.entree.kennisnet.nl/openaselect/sso/wayfsearch2?type=getAll&spCode=” & entityId)
            Dim wayfsearch As JArray = JArray.Parse(json)
            Dim ProviderID As String = ""
            For Each w In wayfsearch.Children
                'zoek voor het juiste providerID bij de opgegeven BRIN
                If w("ko")("brin").ToString().ToLower() = Brin.ToLower() Then
                    ProviderID = w("idp")("asorgcode").ToString()
                End If
            Next

            If String.IsNullOrEmpty(ProviderID) = False Then 'ProviderID gevonden
                Dim ips As IDPList = New IDPList()
                Dim ipe As IDPEntry = New IDPEntry()
                ipe.ProviderID = ProviderID
                ips.IDPEntries.Add(ipe)
                Dim scopeing As Scoping = New Scoping()
                scopeing.IDPList = ips
                scopeing.ProxyCount = 2
                authnRequest.Scoping = scopeing
            End If
        End If
        authnRequest.ProtocolBinding = SAMLIdentifiers.BindingURIs.HTTPPost
            authnRequest.AssertionConsumerServiceURL = ConfigurationManager.AppSettings("AssertionConsumerServiceURL")

        Dim authnRequestXml As XmlElement = authnRequest.ToXml()
        ' Add signature
        SAMLMessageSignature.Generate(authnRequestXml, certificate.PrivateKey, certificate)
        Return authnRequestXml
    End Function