Showing posts with label xsd. Show all posts
Showing posts with label xsd. Show all posts

Thursday, August 21, 2008

Identity.xsd reloaded

I was wondering why the identity xml schema was not updated after the release of ISIP 1.5...

Here is my (unautorized) edit. Any xml that validates against the old schema should by valid against this new schema (but not the other way around). Well, I changed the namespace from http://schemas.xmlsoap.org/ws/2005/05/identity/ to http://schemas.xmlsoap.org/ws/2008/08/identity/:


<?xml version="1.0" encoding="utf-8"?>
<!-- 
Copyright © 2006-2007 Microsoft Corporation, Inc. All rights reserved. 
Edited for Identity Selector Interoperability Profile V1.5 by Axel Nennker. Some rights reversed. [sic!]
-->

<xs:schema targetNamespace="http://schemas.xmlsoap.org/ws/2008/08/identity"
    xmlns:tns="http://schemas.xmlsoap.org/ws/2008/08/identity" 
    xmlns:wsa="http://www.w3.org/2005/08/addressing" 
    xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" 
    xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 
    xmlns:enc="http://www.w3.org/2001/04/xmlenc#"
    
    elementFormDefault="qualified" blockDefault="#all" 

    version="0.1" >

  <xs:import 
      namespace="http://www.w3.org/2001/04/xmlenc#" 
      schemaLocation="http://www.w3.org/TR/xmlenc-core/xenc-schema.xsd"/>
  <xs:import 
      namespace="http://www.w3.org/2005/08/addressing" 
      schemaLocation="http://www.w3.org/2006/03/addressing/ws-addr.xsd"/>
  <xs:import 
      namespace="http://schemas.xmlsoap.org/ws/2004/09/policy" 
      schemaLocation="http://schemas.xmlsoap.org/ws/2004/09/policy/ws-policy.xsd" /> 
  <xs:import 
      namespace="http://schemas.xmlsoap.org/ws/2005/02/trust" 
      schemaLocation="http://schemas.xmlsoap.org/ws/2005/02/trust/ws-trust.xsd" />
  <xs:import
      namespace="http://www.w3.org/2000/09/xmldsig#"
      schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"/>
  <xs:import
      namespace="http://www.w3.org/XML/1998/namespace"
      schemaLocation="http://www.w3.org/2001/xml.xsd"/>
  
  <!-- Standard claim types defined by the InformationCard model -->

  <xs:simpleType name="StringMaxLength255MinLength1">
    <xs:restriction base="xs:string">
      <xs:maxLength value="255"/>
      <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="StringMaxLength64MinLength1">
    <xs:restriction base="xs:string">
      <xs:maxLength value="64"/>
      <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="StringMaxLength684">
    <xs:restriction base="xs:string">
      <xs:maxLength value="684"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="Base64BinaryMaxSize1MB">
    <xs:restriction base="xs:base64Binary">
      <xs:maxLength value="1048576"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="Base64BinaryMaxSize16K">
    <xs:restriction base="xs:base64Binary">
      <xs:maxLength value="16384"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="Base64BinaryMaxSize1K">
    <xs:restriction base="xs:base64Binary">
      <xs:maxLength value="1024"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="PositiveUnsignedInt">
    <xs:restriction base="xs:unsignedInt">
      <xs:minInclusive value="1"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:complexType name="AttributedEmptyElement">
    <xs:anyAttribute namespace="##other" processContents="lax" />
  </xs:complexType>

  <xs:element name="DisplayCredentialHint" type="tns:StringMaxLength64MinLength1" />
  <xs:element name="Username" type="tns:StringMaxLength255MinLength1" />

  <xs:element name="PrivatePersonalIdentifier" type="tns:Base64BinaryMaxSize1K" />
  <xs:element name="IsSelfIssued" type="xs:boolean" />
  <xs:element name="MasterKey" type="tns:Base64BinaryMaxSize1K" />
  <xs:element name="PinDigest" type="tns:Base64BinaryMaxSize1K" />

  <xs:element name="HashSalt" type="tns:Base64BinaryMaxSize1K" />
  <xs:element name="IssuerId" type="tns:Base64BinaryMaxSize16K" />
  <xs:element name="BackgroundColor" type="xs:int" />
  <xs:element name="CardName" type="tns:StringMaxLength255MinLength1" />

  <xs:element name="Issuer" type="xs:anyURI" />
  <xs:element name="IssuerName" type="tns:StringMaxLength64MinLength1" />
  <xs:element name="TimeIssued" type="xs:dateTime" />
  <xs:element name="TimeExpires" type="xs:dateTime" />

  <xs:element name="TimeLastUpdated" type="xs:dateTime" />
  <xs:element name="StoreSalt" type="tns:Base64BinaryMaxSize1K" />
  <xs:element name="EntryName" type="tns:StringMaxLength64MinLength1" />
  <xs:element name="EntryValue" type="tns:StringMaxLength684" />

  <xs:simpleType name="LogoImageType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="image/jpeg"/>
      <xs:enumeration value="image/gif"/>
      <xs:enumeration value="image/bmp" />
      <xs:enumeration value="image/png" />
      <xs:enumeration value="image/tiff" />
    </xs:restriction>
  </xs:simpleType>
  
  <xs:complexType name="BaseClaimType" abstract="true">
    <xs:attribute name="Uri" type="xs:anyURI" use="required" />
  </xs:complexType>

  <xs:element name="ClaimType" type="tns:ClaimType" />
  <xs:complexType name="ClaimType">
    <xs:complexContent>
      <xs:extension base="tns:BaseClaimType">
        <xs:attribute name="Optional" type="xs:boolean" />
        <xs:anyAttribute namespace="##other" processContents="lax" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:element name="SupportedClaimType" type="tns:SupportedClaimType" />
  <xs:complexType name="SupportedClaimType">
     <xs:complexContent>
       <xs:extension base="tns:BaseClaimType">
         <xs:sequence>
          <xs:element name="DisplayTag" type="tns:StringMaxLength255MinLength1" minOccurs="0" />
          <xs:element name="Description" type="tns:StringMaxLength255MinLength1" minOccurs="0" />
        </xs:sequence>
        <xs:anyAttribute namespace="##other" processContents="lax" />

      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:element name="InformationCardReference" type="tns:InformationCardReferenceType" />
  <xs:complexType name="InformationCardReferenceType">
    <xs:sequence>
      <xs:element name="CardId" type="xs:anyURI" />
      <xs:element name="CardVersion" type="tns:PositiveUnsignedInt"/>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="CardImage" type="tns:CardImageType" />

  <xs:complexType name="CardImageType">
    <xs:simpleContent>
      <xs:extension base="tns:Base64BinaryMaxSize1MB">
        <xs:attribute name="MimeType" type="tns:LogoImageType" use="required"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:element name="UsernamePasswordCredential" type="tns:UsernamePasswordCredentialType" />
  <xs:complexType name="UsernamePasswordCredentialType">
    <xs:sequence>
      <xs:element ref="tns:Username" minOccurs="0"/>

    </xs:sequence>
  </xs:complexType>

  <xs:element name="KerberosV5Credential" type="tns:AttributedEmptyElement" />

  <xs:element name="X509V3Credential" type="tns:X509V3CredentialType" />
  <xs:complexType name="X509V3CredentialType">

    <xs:sequence>
      <xs:element ref="ds:X509Data"/>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="SelfIssuedCredential" type="tns:SelfIssuedCredentialType" />
  <xs:complexType name="SelfIssuedCredentialType">

    <xs:sequence>
      <xs:element ref="tns:PrivatePersonalIdentifier"/>
    </xs:sequence>
  </xs:complexType>
  
  <xs:element name="UserCredential" type="tns:UserCredentialType" />
  <xs:complexType name="UserCredentialType">

    <xs:sequence>
      <xs:element ref="tns:DisplayCredentialHint" minOccurs="0" />
      <xs:choice>
        <xs:element ref="tns:UsernamePasswordCredential" />
        <xs:element ref="tns:KerberosV5Credential" />

        <xs:element ref="tns:X509V3Credential" />
        <xs:element ref="tns:SelfIssuedCredential" />
        <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax" />
      </xs:choice>

    </xs:sequence>
  </xs:complexType>

  <xs:element name="IssuerInformationEntry" type="tns:IssuerInformationEntryType" />
  <xs:complexType name="IssuerInformationEntryType">
    <xs:sequence>
      <xs:element ref="tns:EntryName" />
      <xs:element ref="tns:EntryValue" />
    </xs:sequence>
  </xs:complexType>

  <xs:element name="IssuerInformation" type="tns:IssuerInformationType" />
  <xs:complexType name="IssuerInformationType">

    <xs:sequence>
      <xs:element ref="tns:IssuerInformationEntry" minOccures="1" />
    </xs:sequence>
  </xs:complexType>


  <xs:element name="TokenService" type="tns:TokenServiceType" />

  <xs:complexType name="TokenServiceType">
    <xs:sequence>
      <xs:element ref="wsa:EndpointReference" />
      <xs:element ref="tns:UserCredential"/>
    </xs:sequence>
    <xs:anyAttribute namespace="##other" processContents="lax" />

  </xs:complexType>

  <xs:element name="TokenServiceList" type="tns:TokenServiceListType" />
  <xs:complexType name="TokenServiceListType">
    <xs:sequence>
      <xs:element ref="tns:TokenService" maxOccurs="128"/>

    </xs:sequence>
  </xs:complexType>

  <xs:element name="SupportedTokenTypeList" type="tns:SupportedTokenTypeListType" />
  <xs:complexType name="SupportedTokenTypeListType">
    <xs:sequence>
      <xs:element ref="wst:TokenType" maxOccurs="32"/>

    </xs:sequence>
  </xs:complexType>

  <xs:element name="SupportedClaimTypeList" type="tns:SupportedClaimTypeListType" />
  <xs:complexType name="SupportedClaimTypeListType">
    <xs:sequence>
      <xs:element ref="tns:SupportedClaimType" maxOccurs="128"/>

    </xs:sequence>
  </xs:complexType>

  <xs:element name="RequireAppliesTo" type="tns:RequireAppliesToType" />
  <xs:complexType name="RequireAppliesToType">
    <xs:attribute name="Optional" type="xs:boolean" />

  </xs:complexType>
  
  <xs:element name="RequestDisplayToken">
    <xs:complexType>
      <xs:attribute ref="xml:lang" use="optional" />
      <xs:anyAttribute namespace="##other" processContents="lax" />

    </xs:complexType>
  </xs:element>
  
  <xs:element name="DisplayClaim" type="tns:DisplayClaimType" />
  <xs:complexType name="DisplayClaimType">
    <xs:complexContent>
      <xs:extension base="tns:SupportedClaimType">

        <xs:sequence>
          <xs:element name="DisplayValue" type="tns:StringMaxLength255MinLength1" minOccurs="0" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

   <xs:simpleType name="DisplayTokenTextContentType">
     <xs:restriction base="xs:token">
      <xs:enumeration value="text/plain" />
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="DisplayTokenText" type="tns:DisplayTokenTextType" />

  <xs:complexType name="DisplayTokenTextType">
    <xs:simpleContent>
      <xs:extension base="tns:StringMaxLength255MinLength1">
        <xs:attribute name="MimeType" type="tns:DisplayTokenTextContentType" use="required" />
        <xs:anyAttribute namespace="##other" processContents="lax" />

      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:element name="DisplayToken" type="tns:DisplayTokenType" />
  <xs:complexType name="DisplayTokenType">
    <xs:choice>

      <xs:element ref="tns:DisplayClaim" maxOccurs="unbounded" />
      <xs:element ref="tns:DisplayTokenText" />
    </xs:choice>
    <xs:anyAttribute namespace="##other" processContents="lax" />
  </xs:complexType>

  <xs:element name="RequestedDisplayToken" type="tns:RequestedDisplayTokenType" />
  <xs:complexType name="RequestedDisplayTokenType">
    <xs:sequence>
      <xs:element ref="tns:DisplayToken" />
    </xs:sequence>

    <xs:anyAttribute namespace="##other" processContents="lax" />
  </xs:complexType>

  <xs:element name="RequireStrongRecipientIdentity" type="tns:PolicyAssertionType" />
  <xs:element name="RequireFederatedIdentityProvisioning" type="tns:PolicyAssertionType" />

  <xs:complexType name="PolicyAssertionType">
    <xs:sequence>
      <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax" />
    </xs:sequence>
    <xs:anyAttribute namespace="##any" processContents="lax" />

  </xs:complexType>
  
  <xs:element name="PrivacyNotice" type="tns:PrivacyNoticeLocationType" />
  <xs:complexType name="PrivacyNoticeLocationType">
    <xs:simpleContent>
      <xs:extension base="xs:anyURI">
        <xs:attribute name="Version" use="optional" type="tns:PositiveUnsignedInt"/>

        <xs:anyAttribute namespace="##any" processContents="lax" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:element name="ClaimValue" type="tns:ClaimValueType" />

  <xs:complexType name="ClaimValueType">
    <xs:complexContent>
      <xs:extension base="tns:BaseClaimType">
        <xs:sequence>
          <xs:element name="Value" type="tns:StringMaxLength684" />
        </xs:sequence>

      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:element name="ClaimValueList" type="tns:ClaimValueListType" />
  <xs:complexType name="ClaimValueListType">
    <xs:sequence>

      <xs:element ref="tns:ClaimValue" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="InformationCard" type="tns:InformationCardType" />
  <xs:complexType name="InformationCardType">

    <xs:sequence>
      <xs:element ref="tns:InformationCardReference" />
      <xs:element ref="tns:CardName" minOccurs="0" />
      <xs:element ref="tns:CardImage" minOccurs="0" />
      <xs:element ref="tns:Issuer" />

      <xs:element ref="tns:TimeIssued" />
      <xs:element ref="tns:TimeExpires" minOccurs="0" />
      <xs:element ref="tns:TokenServiceList" minOccurs="0"/>
      <xs:element ref="tns:SupportedTokenTypeList" />

      <xs:element ref="tns:SupportedClaimTypeList" />
      <xs:element ref="tns:RequireAppliesTo" minOccurs="0" />
      <xs:element ref="tns:PrivacyNotice" minOccurs="0" />
      <xs:element ref="tns:RequireStrongRecipientIdentity" minOccurs="0" />
      <xs:element ref="tns:IssuerInformation" minOccurs="0" maxOccurs="unbounded" />
      <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="xml:lang" use="required"/>

  </xs:complexType>

  <xs:element name="InformationCardMetaData" type="tns:InformationCardMetaDataType" />
  <xs:complexType name="InformationCardMetaDataType">
    <xs:complexContent>
      <xs:extension base="tns:InformationCardType">
        <xs:sequence>

          <xs:element ref="tns:IsSelfIssued" />
          <xs:element ref="tns:PinDigest" minOccurs="0"/>
          <xs:element ref="tns:HashSalt" />
          <xs:element ref="tns:TimeLastUpdated" />
          <xs:element ref="tns:IssuerId" />

          <xs:element ref="tns:IssuerName" />
          <xs:element ref="tns:BackgroundColor" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:element name="InformationCardPrivateData" type="tns:InformationCardPrivateDataType" />
  <xs:complexType name="InformationCardPrivateDataType">
    <xs:sequence>
      <xs:element ref="tns:MasterKey" />
      <xs:element ref="tns:ClaimValueList" minOccurs="0" />

    </xs:sequence>
  </xs:complexType>

  <xs:element name="RoamingInformationCard" type="tns:RoamingInformationCardType" />
  <xs:complexType name="RoamingInformationCardType">
    <xs:sequence>
      <xs:element ref="tns:InformationCardMetaData" />

      <xs:element ref="tns:InformationCardPrivateData" minOccurs="0" />
    </xs:sequence>
  </xs:complexType>

  <xs:element name="RoamingStore" type="tns:RoamingStoreType" />
  <xs:complexType name="RoamingStoreType">

    <xs:sequence>
      <xs:element ref="tns:RoamingInformationCard" minOccurs="1" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="EncryptedStore" type="tns:EncryptedStoreType" />

  <xs:complexType name="EncryptedStoreType">
    <xs:sequence>
      <xs:element ref="tns:StoreSalt" />
      <xs:element ref="enc:EncryptedData" />
    </xs:sequence>
  </xs:complexType>

  
</xs:schema>

Information Cards: More Subtleties

Another post in my new series (1,2) of posts related to things you never wanted to know about Information Cards:

  • Why does the infocard.xsd define PositiveUnsignedInt when there is a XML standard positiveInteger already defined? Maybe I am missing a suble difference?
  • Did you notice that the length of a claim's value is restricted to be less or equal than 684 in length?
    <xs:complexType name="ClaimValueType">
      <xs:complexContent>
       <xs:extension base="tns:BaseClaimType">
        <xs:sequence>
        <xs:element name="Value" type="tns:StringMaxLength684"/>
       </xs:sequence>
      </xs:extension>
      </xs:complexContent>
    </xs:complexType>
    I am very interested to here the story who came up with this number and why (My guess is that a Windows UI component restricts the length...). People who suggest to store whole customer profiles in claims should be aware of this restriction.
  • Did you know that the username/password credential hint is limited to 64 characters in length?! This makes Pamela's invalid Information Card (I4-badidp1.crd) even more invalid.