<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/xsl' href='http://xml2rfc.tools.ietf.org/authoring/rfc2629.xslt' ?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">

<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>

<rfc category="std" docName="draft-hunt-idevent-token-06" ipr="trust200902">
  <front>
    <title abbrev="draft-hunt-idevent-token">Security Event Token (SET)</title>

    <author fullname="Phil Hunt" initials="P." role="editor" surname="Hunt">
      <organization abbrev="Oracle">Oracle Corporation</organization>

      <address>
        <email>phil.hunt@yahoo.com</email>
      </address>
    </author>
    
    <author fullname="William Denniss" initials="W." surname="Denniss">
      <organization abbrev="Google">Google</organization>

      <address>
        <email>wdenniss@google.com</email>
      </address>
    </author>
    

    <author fullname="Morteza Ansari" initials="M.A." surname="Ansari">
      <organization abbrev="Cisco">Cisco</organization>

      <address>
        <email>morteza.ansari@cisco.com</email>
      </address>
    </author>

    <author fullname="Michael B. Jones" initials="M.B." surname="Jones">
      <organization abbrev="Microsoft">Microsoft</organization>
      <address>
        <email>mbj@microsoft.com</email>
	      <uri>http://self-issued.info/</uri>
      </address>
    </author>

    <date year="2016"/>

    <area>Security</area>

    <keyword>Identity</keyword>
    <keyword>Event</keyword>
    <keyword>Token</keyword>
    <keyword>Internet-Draft</keyword>

    <abstract>
      <t>This specification defines the Security Event token, which may
      be distributed via a protocol such as HTTP. The Security Event Token 
      (SET) specification profiles the JSON Web Token (JWT) and may be optionally signed 
      and/or encrypted. A SET describes a statement of fact that may be 
      shared by an event publisher with event subscribers.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="intro" title="Introduction and Overview" toc="default">
      <t>This specification defines an extensible Security Event Token 
      (SET) format which may be exchanged using protocols such as HTTP. 
      The specification builds on the JSON Web Token (JWT) format <xref target="RFC7519"/> 
      in order to provide a self-contained token that can be optionally 
      signed using JSON Web Signature (JWS) <xref target="RFC7515"/>
      and/or encrypted using JSON Web Encryption (JWE) <xref target="RFC7516"/>.</t>
      
      <t>For the purpose of this specification, an event is a statement
      of fact by a publisher (also known as the event issuer) that the state of 
      a security subject (e.g., a web resource, token, IP address) it 
      controls or is aware of, has changed in some way (explicitly or 
      implicitly). A security subject may be permanent (e.g., a user account) or 
      temporary (e.g., a login session) in nature. A state change 
      may include direct changes of entity state, implicit changes to state 
      or other higher-level security statements such as:
      <list style="symbols">
        <t>The creation, modification, removal of a resource.</t>
        <t>The resetting or suspension of an account.</t>
        <t>The revocation of a security token prior to its expiry.</t>
        <t>The logout of a user session. Or, </t>
        <t>A cumulative conclusion such as to indicate that a user has 
        taken over an email identifier that may have been used in the 
        past by another user.</t>
      </list>
      </t>
      
      <t>Based on some agreed upon criteria for an event Feed, 
      the publisher distributes events to the appropriate subscribers.
      While an event may be delivered via synchronous means (e.g., HTTP POST),
      the distribution of the event often happens asynchronously to the 
      change of state which generated the security event. As an example, 
      an OAuth2 Authorization Server <xref target="RFC6749"/>, 
      having received a token revocation request <xref target="RFC7009"/>, 
      may issue a token revocation event to downstream web resource
      providers. Having been informed of a token revocation, the OAuth2 web
      resource service provider may add the token identifier to its 
      local revocation list assuming the token has not already expired.</t>
      
      <t>A subscriber having received an event, validates and interprets the
      event and takes its own independent action, if any. For example, 
      having been informed of a personal identifier now being associated 
      with a different security subject (i.e., is being used by someone else), the 
      subscriber may choose to ensure that the new user is not granted 
      access to resources associated with the previous user. Or it may
      not have any relationship with the subject, and no action is taken.</t>
      
      <t>While subscribers will often take actions upon receiving one
      or more events, events MUST NOT be assumed to be commands or requests. 
      To do so requires complex bi-directional signals and error recovery 
      mechanisms that fall outside the scope of this specification. 
      The intent of this specification is to define a way of exchanging 
      statements of fact that subscribers may interpret for their own
      purposes. Since events are typically historical statements by a publisher
      and are not commands, idempotency or lack thereof, does not apply.</t>
      
      <t>Unless otherwise specified, this specification uses example 
      events intended as non-normative examples showing how an event may be 
      used. It is expected that other specifications will use
      this specification to define normative events.</t>
      
      <t>This specification is scoped to security and identity related events.
      While event tokens may be used for other purposes, the specification
      only considers security and privacy concerns relevant to identity 
      and personal information.</t>

      <section anchor="notat" title="Notational Conventions" toc="default">
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
        "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
        document are to be interpreted as described in <xref
        target="RFC2119"/>. These keywords are capitalized when used to
        unambiguously specify requirements of the protocol or application
        features and behavior that affect the inter-operability and security of
        implementations. When these words are not capitalized, they are meant
        in their natural-language sense.</t>

        <t>For purposes of readability, examples are not URL encoded.
        Implementers MUST percent encode URLs as described in <xref
        target="RFC3986">Section 2.1 of</xref>.</t>

        <t>Throughout this document, all figures MAY contain spaces and extra
        line-wrapping for readability and space limitations. Similarly, some
        URIs contained within examples have been shortened for space and
        readability reasons.</t>
      </section>

      <section anchor="defs" title="Definitions" toc="default">
        
        <t>
          The following definitions are used with SETs:
          <list style="hanging">
            
            <t hangText="Feed Publisher"><vspace blankLines="0"/>The Feed Publisher creates
              SETs to be distributed to registered subscribers. In JWT
              terminology, the Feed Publisher is also known as the issuer
              (<spanx style="verb">iss</spanx>).
            </t>

            <t hangText="Security Event Token (SET)"><vspace blankLines="0"/>An SET is a 
              JWT that is to be
              distributed to one or more registered subscribers. A SET MAY
              be signed or encrypted using JWS and/or JWE for authentication 
              and confidentiality reasons.
            </t>

            <t hangText="Feed"><vspace blankLines="0"/>A Feed is a logical
              grouping of SETs or a context under which SETs may be issued. 
              A Subscriber registers with the Feed Publisher to subscribe
              to SETs associated with a Feed. How a Feed is defined or
              the method for subscription is out-of-scope of this specification.
            </t>
            
            <t hangText="Subscriber"><vspace blankLines="0"/>A Subscriber 
              registers to receive SETs from a Feed Publisher using a protocol 
              such as  HTTP. The method of registration and delivery is out-of-scope
              of this specification.
            </t>
            
            <t hangText="Security Subject"><vspace blankLines="0"/>A 
            Security Subject is the entity to which a SET refers. A 
            Security Subject may be a principle (e.g., 
            <xref target="RFC7519">Section 4.1.2</xref>), a web resource,
            or other thing such as an IP address that a SET might reference.</t>
          </list>
        </t>
      </section>
    </section>

    <section anchor="events" title="The Security Event Token (SET)">
      <t>A SET conveys a statement (in the form of a JWT
      <xref target="RFC7519"/>) about a single security event in relation
      to a Security Subject that may be of 
      interest to a Subscriber or set of Subscribers receiving SETs from
      a Feed Publisher.</t>
      
      <t>The schema and structure of a SET follows the JWT <xref target="RFC7519"/>
      specification. A SET has the following structure:
      <list style="symbols">
        <t>An outer JSON structure that acts as the SET envelope. The envelope 
        contains a set of JSON attributes, called JWT claims, typically common to every 
        SET or common to a number of different Security Events within a 
        single profiling specification or a related series of specifications. 
        Claims in the envelope SHOULD be registered in the JWT Token 
        Claims Registry <xref target="RFC7519">Section 10.1</xref> or be
        Public Claims or Private Claims as also defined in <xref target="RFC7519"/>.</t>
        
        <t>Envelope claims that are profiled and defined 
        in this specification are used to validate the SET and determine 
        the event data included. The claim <spanx style="verb">events</spanx>
        describes the type of SET event 
        and indicates the data that MAY be present in the SET. While a SET 
        contains a single event, it MAY have multiple extensions providing 
        additional data about the same event. The primary event is the first 
        value in the <spanx style="verb">events</spanx> array, while event 
        extensions are the 2nd, 3rd, etc.</t> 
        
        <t>For each value of <spanx style="verb">events</spanx>, a JSON 
        attribute, whose value is a JSON object, MAY be added known as an 
        event "payload". The payload object contains claims
        typically unique to the events URI value and are not
        registered as JWT claims. These claims are defined
        within their associated event specification. Event extensions can 
        be used for many purposes. Some examples include but are not limited 
        to:<list style="symbols">
          <t>A categorization extension applied to multiple event types 
          in order to provide classification information (e.g. threat type or level).</t>
          <t>Enhancement of an existing specifications the arise over time.</t>
          <t>Correlation extensions needed to link a potential series of events.</t>
          <t>Localized contextual extensions needed between a publisher and subscriber.</t>
        </list></t>
        
      </list>
      </t>

      <figure anchor="examplePassword" title="Example SCIM Password Reset Event">
        <preamble>The following is a non-normative example showing a hypothetical 
        SCIM password reset SET. The example also shows an example where the 
        issuer has provided an extension 
        (<spanx style="verb">https://example.com/scim/event/passwordResetExt</spanx>)
        that is used to convey additional information such as the current
        count of reset attempts:</preamble>
        <artwork>
{ 
  "jti": "3d0c3cf797584bd193bd0fb1bd4e7d30",
  "events":[
    "urn:ietf:params:scim:event:passwordReset",
    "https://example.com/scim/event/passwordResetExt"
  ],
  "iat": 1458496025,
  "iss": "https://scim.example.com",  
  "aud":[
    "https://jhub.example.com/Feeds/98d52461fa5bbc879593b7754",
    "https://jhub.example.com/Feeds/5d7604516b1d08641d7676ee7"
  ],  
  "sub":"https://scim.example.com/Users/44f6142df96bd6ab61e7521d9",
  "urn:ietf:params:scim:event:passwordReset":{
    "id":"44f6142df96bd6ab61e7521d9"
  },
  "https://example.com/scim/event/passwordResetExt":{
     "resetAttempts":5
  }
}
</artwork>
      </figure>      
      <t>The event in the figure above expresses hypothetical password
      reset event for SCIM <xref target="RFC7644"/>. The JWT consists of:<list style="symbols">
        <t>An <spanx style="verb">events</spanx> claim specifying the hypothetical 
        SCIM urn (<spanx style="verb">urn:ietf:params:scim:event:passwordReset</spanx>) 
        for a password reset, and a custom extension, 
        <spanx style="verb">https://example.com/scim/event/passwordResetExt</spanx>, 
        that is used to provide additional event information such as the 
        current count of resets.</t>
        <t>An <spanx style="verb">iss</spanx>
        claims, denotes the event publisher.</t>
        <t>The <spanx style="verb">sub</spanx> claims specifies the SCIM 
        resource URI that was affected.</t>
        <t>The <spanx style="verb">aud</spanx> claims specifies the 
        intended audience for the event. In practical terms, this MAY be 
        the URI for the event Feed that a client has subscribed to.
        </t>
      </list></t>
      
      <t>Additional extensions to an event may be added by adding more 
      values to the <spanx style="verb">events</spanx> claims. For 
      each event URI value specified, there MAY be a corresponding 
      claim that has a JSON object that contains the claims 
      associated with that event (e.g.,
      <spanx style="verb">https://example.com/scim/event/passwordResetExt</spanx>).
      In this example, the SCIM event indicates that a password has been updated 
      and the current password reset count is 5. Notice that the value for 
      "resetAttempts" is actually part of its own JSON object 
      <spanx style="verb">https://example.com/scim/event/passwordResetExt</spanx>.  
      </t>

      <t><figure anchor="exampleBackLogoutEvent" title="Example OpenID Logout Event">
            <preamble>Here is another example event token, this one
              for a Logout Token:</preamble>

            <artwork>
{
  "iss": "https://server.example.com",
  "aud": "https://rp.example.com",
  "jti": "3d0c3cf797584bd193bd0fb1bd4e7d30",
  "iat": 1458668180,
  "exp": 1458668580,
  "sub": "248289761001",
  "events": [
    "https://specs.openid.net/logout"
  ],
  "https://specs.openid.net/logout": {
    "iss": "https://token.example.com",
    "sid": "08a5019c-17e1-4977-8f42-65a12843ea02"
  }
}
</artwork>
          </figure>In the above example, the event has its own issuer, 
          <spanx style="verb">https://server.example.com</spanx> while the event is
          about the logging out of a user session identified in the event
          extension by <spanx style="verb">jti</spanx>
          that was issued by <spanx style="verb">https://token.example.com</spanx>.
          </t>
          <t>
          
          <figure anchor="exampleConsent" title="Example Consent Event">
        <preamble>In the following example, a fictional medical service collects 
          consent for medical actions and notifies other parties. The individual
          for whom consent is identified was originally authenticated via
          OpenID Connect.  In this case, the issuer of the SET event is an
          application rather than the OpenID provider:</preamble>
        <artwork>
{ 
  "jti": "fb4e75b5411e4e19b6c0fe87950f7749",
  "events":[
    "https://openid.net/heart/consent.html"
  ],
  "sub": "248289761001",
  "iat": 1458496025,
  "iss": "https://my.examplemed.com",  
  "aud":[
    "https://rp.example.com"
  ],  
  "https://openid.net/heart/consent":{
    "consentUri":[
      "https://terms.examplemed.com/labdisclosure.html#Agree"
    ]
  }
}
</artwork>
      </figure>  
      In the above example <spanx style="verb">iss</spanx> and <spanx style="verb">sub</spanx>
      contained within the claim <spanx style="verb">https://openid.net/heart/consent</spanx>, refer
      to the subject and issuer of the original OpendID Provider. They are
      distinct from the top level value of <spanx style="verb">iss</spanx>
      which always refers to the issuer of the event - a medical consent
      service that is a relying party to the OpenID Provider.
          </t>
      
      <section anchor="EventContents" title="Core SET Claims">
        <t>The following are claims that are based on <xref target="RFC7519"/>
        claim definitions and are profiled for use in an event
        token:<list style="hanging">
            <t hangText="jti"><vspace blankLines="0"/>As defined by 
            <xref target="RFC7519">Section 4.1.7</xref> contains a unique
            identifier for an event. The identifier SHOULD be unique within
            a particular event Feed and MAY be used by clients to track
            whether a particular event has already been received. This 
            claim is REQUIRED.</t>

            <t hangText="iss"><vspace blankLines="0"/>A single valued
            String containing the URI of the service provider publishing
            the SET (the issuer). This claim is REQUIRED.</t>
 
            <t hangText="aud"><vspace blankLines="0"/>A multi-valued String containing the URIs
            representing the audience of the event. Values are typically URLs of
            the Feeds the event is associated with. When an event has
            multiple audiences that go to the same subscriber, the publisher is not
            obligated to deliver repeated events to the same subscriber.
            This claim is RECOMMENDED.</t>
            
            <t hangText="iat"><vspace blankLines="0"/>As defined by <xref target="RFC7519">Section 4.1.6</xref>,
            a value containing a NumericDate, which represents when the 
            event was issued. Unless otherwise specified,
            the value SHOULD be interpreted by the subscriber as equivalent 
            to the actual time of the event. This claim is REQUIRED. 
            </t> 
            
            <t hangText="nbf"><vspace blankLines="0"/>As defined by 
            <xref target="RFC7519">Section 4.1.5</xref>, a value 
            containing a NumericDate, which represents a future date when
            the event will occur. This claim is OPTIONAL.</t> 
            
            <t hangText="sub">As defined by <xref target="RFC7519">Section 4.1.2</xref>,
            a String or URI value representing the principal or the subject of the SET. 
            This is usually the entity whose "state" was changed. For example,
            an IP Address was added to a black list. A URI representing a
            user resource that was modified. A token identifier for a revoked 
            token. If used, the profile specification SHOULD
            define the content and format semantics for the value. This claim
            is OPTIONAL, as the principal for any given profile may already be
            identified without the inclusion of a subject claim.</t>   
            
            <t hangText="exp">As defined by <xref target="RFC7519"/>, this claim
            is time on which the JWT MUST NOT be accepted for processing. In 
            the context of a SET however, this notion does not apply since
            a SET reflects something that has already been processed and is
            historical in nature. While some specifications MAY have a need
            for this claim, its use in general cases is NOT RECOMMENDED.</t>       
          </list>
        </t>
        <t>The following are new claims defined by this specification:<list style="hanging">
            <t hangText="events" anchor="eventDef"><vspace blankLines="0"/>A multi-valued 
            String that contains one or more URIs representing the type 
            of event being expressed and the claims that MAY be available
            within the JWT. The first value SHALL indicate the type of SET event
            and following values represent extensions to that event. 
            For each value present, there MAY be an associated JSON sub-objects
            present in the SET. Each JSON sub-object is denoted 
            by a claim whose name matches a value in 
            <spanx style="verb">events</spanx>.  This claim is 
            REQUIRED to have at least one value.</t>
            <t hangText="txn" anchor="txnDef"><vspace/>An OPTIONAL single-valued
            String value that represents a unique transaction identifier. In cases where
            multiple SETs are issued based on different event URIs, the transaction
            identifier MAY be used to correlate SETs to the same 
            originating event or stateful change.</t>
        </list></t>
      </section>

      <section anchor="eventMessage" title="Security Event Token Construction">
        <t>A SET is a JWT <xref target="RFC7519"/> that is 
        constructed by building a JSON structure that constitutes an event 
        object and which is then used as the body of a JWT.</t>
        <t>While this specification uses JWT to convey a SET, implementers
        SHALL NOT use SETs to convey authentication or authorization assertions.</t>

        <t><figure anchor="exampleJsonEvent" title="Example Event JSON Data">
            <preamble>The
            following is an example event token (which has been formatted
            for readability):</preamble>

            <artwork>
{  
  "jti": "4d3559ec67504aaba65d40b0363faad8",
  "iat": 1458496404,
  "iss": "https://scim.example.com",  
  "aud":[
   "https://scim.example.com/Feeds/98d52461fa5bbc879593b7754",
   "https://scim.example.com/Feeds/5d7604516b1d08641d7676ee7"
  ],  
  
  "events":[
    "urn:ietf:params:scim:event:create"
  ],
  "urn:ietf:params:scim:event:create":{
    "ref": "https://scim.example.com/Users/44f6142df96bd6ab61e7521d9",
    "attributes":["id", "name", "userName", "password", "emails"],
    "values":{
      "emails":[
       {"type":"work", "value":"jdoe@example.com"}
      ],
      "password":"not4u2no",
      "userName":"jdoe",
      "id":"44f6142df96bd6ab61e7521d9",
      "name":{
        "givenName":"John",
        "familyName":"Doe"
      }
    }  
  }
}
</artwork>
          </figure></t>

        <t>When transmitted, the above JSON body must be converted into a JWT
        as per <xref target="RFC7519"/>. In this
        example, because the event contains attribute values, the token MUST
        be encrypted per JWE (see <xref
        target="RFC7516"/>) before transmission.</t>
     
        <t><figure>
            <preamble>The following is an example of a SCIM Event expressed as
            an unsecured JWT. The JWT header of:</preamble>

            <artwork>{"alg":"none"}</artwork>
          </figure><figure>
            <preamble>Base64url encoding of the octets of the UTF-8
            representation of the header yields:</preamble>

            <artwork>eyJhbGciOiJub25lIn0</artwork>
          </figure>
	  <figure>
            <preamble>The example JSON Event Data is encoded as
            follows:</preamble>

            <artwork>
eyAgCiAgImp0aSI6ICI0ZDM1NTllYzY3NTA0YWFiYTY1ZDQwYjAzNjNmYWFkOCIsCiAg
ImlhdCI6IDE0NTg0OTY0MDQsCiAgImlzcyI6ICJodHRwczovL3NjaW0uZXhhbXBsZS5j
b20iLCAgCiAgImF1ZCI6WwogICAiaHR0cHM6Ly9zY2ltLmV4YW1wbGUuY29tL0ZlZWRz
Lzk4ZDUyNDYxZmE1YmJjODc5NTkzYjc3NTQiLAogICAiaHR0cHM6Ly9zY2ltLmV4YW1w
bGUuY29tL0ZlZWRzLzVkNzYwNDUxNmIxZDA4NjQxZDc2NzZlZTciCiAgXSwgIAogIAog
ICJldmVudHMiOlsKICAgICJ1cm46aWV0ZjpwYXJhbXM6c2NpbTpldmVudDpjcmVhdGUi
CiAgXSwKICAidXJuOmlldGY6cGFyYW1zOnNjaW06ZXZlbnQ6Y3JlYXRlIjp7CiAgICAi
cmVmIjogImh0dHBzOi8vc2NpbS5leGFtcGxlLmNvbS9Vc2Vycy80NGY2MTQyZGY5NmJk
NmFiNjFlNzUyMWQ5IiwKICAgICJhdHRyaWJ1dGVzIjpbImlkIiwibmFtZSIsInVzZXJO
YW1lIiwicGFzc3dvcmQiLCJlbWFpbHMiXSwKICAgICJ2YWx1ZXMiOnsKICAgICAgImVt
YWlscyI6WwogICAgICAgeyJ0eXBlIjoid29yayIsInZhbHVlIjoiamRvZUBleGFtcGxl
LmNvbSJ9CiAgICAgIF0sCiAgICAgICJwYXNzd29yZCI6Im5vdDR1Mm5vIiwKICAgICAg
InVzZXJOYW1lIjoiamRvZSIsCiAgICAgICJpZCI6IjQ0ZjYxNDJkZjk2YmQ2YWI2MWU3
NTIxZDkiLAogICAgICAibmFtZSI6ewogICAgICAgICJnaXZlbk5hbWUiOiJKb2huIiwK
ICAgICAgICAiZmFtaWx5TmFtZSI6IkRvZSIKICAgICAgfQogICAgfSAgCiAgfQp9
</artwork>
          </figure>
          <figure anchor="eventToken"
            title="Example Unsecured Event Token">
            <preamble>The encoded JWS signature is the empty string.
            Concatenating the parts yields:</preamble>

            <artwork>
eyJhbGciOiJub25lIn0
.
eyAgCiAgImp0aSI6ICI0ZDM1NTllYzY3NTA0YWFiYTY1ZDQwYjAzNjNmYWFkOCIsCiAg
ImlhdCI6IDE0NTg0OTY0MDQsCiAgImlzcyI6ICJodHRwczovL3NjaW0uZXhhbXBsZS5j
b20iLCAgCiAgImF1ZCI6WwogICAiaHR0cHM6Ly9zY2ltLmV4YW1wbGUuY29tL0ZlZWRz
Lzk4ZDUyNDYxZmE1YmJjODc5NTkzYjc3NTQiLAogICAiaHR0cHM6Ly9zY2ltLmV4YW1w
bGUuY29tL0ZlZWRzLzVkNzYwNDUxNmIxZDA4NjQxZDc2NzZlZTciCiAgXSwgIAogIAog
ICJldmVudHMiOlsKICAgICJ1cm46aWV0ZjpwYXJhbXM6c2NpbTpldmVudDpjcmVhdGUi
CiAgXSwKICAidXJuOmlldGY6cGFyYW1zOnNjaW06ZXZlbnQ6Y3JlYXRlIjp7CiAgICAi
cmVmIjogImh0dHBzOi8vc2NpbS5leGFtcGxlLmNvbS9Vc2Vycy80NGY2MTQyZGY5NmJk
NmFiNjFlNzUyMWQ5IiwKICAgICJhdHRyaWJ1dGVzIjpbImlkIiwibmFtZSIsInVzZXJO
YW1lIiwicGFzc3dvcmQiLCJlbWFpbHMiXSwKICAgICJ2YWx1ZXMiOnsKICAgICAgImVt
YWlscyI6WwogICAgICAgeyJ0eXBlIjoid29yayIsInZhbHVlIjoiamRvZUBleGFtcGxl
LmNvbSJ9CiAgICAgIF0sCiAgICAgICJwYXNzd29yZCI6Im5vdDR1Mm5vIiwKICAgICAg
InVzZXJOYW1lIjoiamRvZSIsCiAgICAgICJpZCI6IjQ0ZjYxNDJkZjk2YmQ2YWI2MWU3
NTIxZDkiLAogICAgICAibmFtZSI6ewogICAgICAgICJnaXZlbk5hbWUiOiJKb2huIiwK
ICAgICAgICAiZmFtaWx5TmFtZSI6IkRvZSIKICAgICAgfQogICAgfSAgCiAgfQp9
.
</artwork>
          </figure></t>

        <t>To create and or validate a signed or encrypted SET, follow
        the instructions in section 7 of <xref
        target="RFC7519"/>.</t>
      </section>
    </section>

    <section anchor="Security" title="Security Considerations" toc="default">

      
      <section title="Confidentiality and Integrity">
      <t>SETs may often contain sensitive information. Therefore,
      methods for distribution of events SHOULD require the use of a 
      transport-layer security mechanism when distributing events. 
      Parties MUST support TLS 1.2 <xref target="RFC5246"/> and MAY support
      additional transport-layer mechanisms meeting its security
      requirements. When using TLS, the client MUST perform a TLS/SSL server
      certificate check, per <xref target="RFC6125"/>. Implementation
      security considerations for TLS can be found in "Recommendations for
      Secure Use of TLS and DTLS" <xref target="RFC7525"/>.</t>
      
      <t>Security Events distributed through third-parties or that carry personally
      identifiable information, SHOULD be encrypted using JWE <xref target="RFC7516"/>
      or secured for confidentiality by other means.
      </t>
      <t>Security Events distributed without authentication over the channel, such
      as via TLS (<xref target="RFC5246"/> and <xref target="RFC6125"/>), 
      and/or OAuth2 <xref target="RFC6749"/>, or Basic Authentication <xref target="RFC7617"/>,
      MUST be signed using JWS <xref target="RFC7515"></xref> so
      that individual events MAY be authenticated and validated by the subscriber.</t>      
      </section>
      
      <section title="Delivery">
      <t>This specification does not define a delivery mechanism by itself.
      In addition to confidentiality and integrity (discussed above), implementers
      and profile specifications MUST consider the consequences of delivery 
      mechanisms that are not secure and/or not assured. For example, while
      a SET may be end-to-end secured using JWE, that alone will not guarantee
      that the correct subscribing party knows they should have received a particular SET.</t>
      </section>
      
      <section title="Sequencing">
        <t>As defined in this specification, there is no defined way to order
        multiple SETs in a sequence. Depending on the type and nature of SET
        event, order may or may not matter. For example, in provisioning, 
        event order is critical -- an object could not be modified before it
        was created. In other SET types, such as a token revocation, the order
        of SETs for revoked tokens does not matter. If however, the event was
        described as a log-in or logged-out status for a user subject, then 
        order becomes important.</t>
        
        <t>Extension specifications and implementers SHOULD take caution when
        using timestamps such as <spanx style="verb">iat</spanx> to define order. Distributed systems will have 
        some amount of clock-skew and thus time by itself will not guarantee order.</t>
        
        <t>Specifications profiling SET SHOULD define a mechanism for detecting
        order or sequence of events. For example, the <spanx>txn</spanx>
        claim could be defined as an ordered value (e.g. a counter) that the publisher defines.</t>
      </section>
      
      <section title="Timing Issues">
        <t>When SETs are delivered asynchronously and/or out-of-band with respect to
        the original action that incurred the security event, it is important
        to consider that a SET might be delivered to a Subscriber in advance
        or well behind the process that caused the event. For example, a 
        user having been required to logout and then log back in again, may
        cause a logout SET to be issued that may arrive at the same time 
        as the user-agent accesses a web site having just logged-in. If
        timing is not handled properly, the effect would be to erroneously
        treat the new user session as logged out. Profiling specifications 
        SHOULD be careful to anticipate timing and subject selection information. 
        For example, it might be more appropriate to cancel a "session" 
        rather than a "user". Alternatively, the specification could use timestamps
        that allows new sessions to be started immediately after a stated 
        logout event time.</t>
      </section>
      
      <section title="Distinguishing SETs from Access Tokens">
        <t>Because <xref target="RFC7519"/> states that <spanx style="verb">all claims that are not understood
        by implementations MUST be ignored.</spanx>, there is a consideration that 
        a SET token might be confused as an access or authorization token in 
        the case where a SET is mistakenly or intentionally intercepted and 
        presented as an access token. To avoid this it is recommended that
        implementers consider one or more of the following:<list style="symbols">
          <t>Avoid use of the JWT claim <spanx style="verb">exp</spanx> within the
          envelope.</t>
          <t>Where possible, use a separate <spanx style="verb">aud</spanx>
          claim value to distinguish between the SET subscriber and the 
          audience of an access token. For example, a Logout while intended
          for the same relying party could use a different audience to 
          distinguish between normal access and logout notification.</t>
          <t>Modify access validation systems to check for the presence of 
          the <spanx style="verb">events</spanx> claim as a means to detect
          SET event tokens. This is particularly useful if the same endpoint
          may receive both types of tokens.</t>
          <t>Consider avoiding use of the <spanx style="verb">sub</spanx>
          claim at the top level.</t>
        </list></t>
      </section>
    </section>
    
    <section title="Privacy Considerations">
    
      <t>If a SET needs to be retained for audit purposes, JWS MAY 
      be used to provide verification of its authenticity.</t>
      
      <t>Event Publishers SHOULD attempt to specialize Feeds so that the content
      is targeted to the specific business and protocol needs of subscribers.</t>
      
      <t>When sharing personally identifiable information or information
      that is otherwise considered confidential to affected users, the 
      publishers and subscribers MUST have the appropriate legal agreements
      and user consent in place.</t>
      
      <t>The propagation of subject identifiers can be perceived as personally
      identifiable information. Where possible, publishers and subscribers
      should devise approaches that prevent propagation -- for example, the
      passing of a hash value that requires the subscriber to already know
      the subject.</t>
    </section>

    <section anchor="IANA" title="IANA Considerations">

      <section anchor="ClaimsRegistry" title="JSON Web Token Claims Registration">
	<t>
	  This specification registers the <spanx style="verb">events</spanx> and
    the <spanx style="verb">txn</spanx> claims in the IANA
	  "JSON Web Token Claims" registry <xref target="IANA.JWT.Claims"/>
	  established by <xref target="RFC7519"/>.
	</t>

	<section anchor='ClaimsContents' title='Registry Contents'>
	  <t>
	    <?rfc subcompact="yes"?>
	    <list style='symbols'>
	      <t>
		Claim Name: <spanx style="verb">events</spanx>
	      </t>
	      <t>
		Claim Description: Security Event URIs
	      </t>
	      <t>
		Change Controller: IESG
	      </t>
	      <t>
		Specification Document(s): <xref target="events"/> of [[ this specification ]]
	      <vspace blankLines="1"/></t>
        
        <t>
    Claim Name: <spanx style="verb">txn</spanx>
        </t>
        <t>
    Claim Description: SET Transaction Identifier
        </t>
        <t>
    Change Controller: IESG
        </t>
        <t>
    Specification Document(s): <xref target="events"/> of [[ this specification ]]
        </t>
	    </list>
	  </t>
	</section>
	<?rfc subcompact="no"?>
      </section>
      
    </section>
  </middle>

  <back>
    <references title="Normative References">

    <!-- 
      <reference anchor="idevent-subscription">
        
        <front>
          <title>Identity Event Subscription Protocol (work in progress)</title>
          <author fullname="Phil Hunt"><organization>Oracle Corporation</organization></author>
          <date/>
        </front>  
      </reference>
       -->
       
      <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml' ?><!-- Keywords -->
      <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3986.xml'?><!-- URIs -->
      <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5246.xml'?><!-- TLS 1.2 -->
      <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6125.xml'?><!-- TLS Cert-->
      <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6749.xml'?><!-- OAuth 2 -->
      <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7159.xml'?><!-- JSON -->
      <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7519.xml'?><!-- JWT -->
      <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7525.xml'?><!-- TLS BCP -->
      <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7617.xml'?><!-- Basic Auth -->

      <reference anchor="IANA.JWT.Claims" target="http://www.iana.org/assignments/jwt">
        <front>
          <title>JSON Web Token Claims</title>
          <author>
            <organization>IANA</organization>
          </author>
	  <date/>
        </front>
      </reference>

    </references>
 
    <references title="Informative References">
      <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7009.xml'?><!-- OAuth Revocation -->
      <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7515.xml'?><!-- JWS -->
      <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7516.xml'?><!-- JWE -->
      <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7517.xml'?><!-- JWK -->
      <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7644.xml'?><!-- SCIM Protocl -->
    
      <reference anchor="idevent-scim" target="draft-hunt-idevent-scim-00.txt">
        <front>
          <title>SCIM Event Extensions (work in progress)</title>
          <author fullname="Phil Hunt"><organization>Oracle Corporation</organization></author>
          <date/>
        </front>  
      </reference>
 
 <!-- 
      <reference anchor="RISC">
        <front>
          <title>OpenID Risk and Incident Sharing and Coordination (RISC) Working Group</title>
          <author> <organization>OpenID Foundation</organization></author>
          <date/>
        </front>
      </reference>

      <reference anchor="HEART" target="http://openid.net/wg/heart/">
        <front>
          <title>OpenID Health Relationship Trust (HEART) Working Group</title>
          <author> <organization>OpenID Foundation</organization></author>
          <date/>
        </front>
      </reference>
      
       -->

    </references>

    <!-- <section anchor="Contributors" title="Contributors"/> Uncomment if and when this section is non-empty -->

    <section anchor="Acknowledgments" title="Acknowledgments">
      <t>The editors would like to thank the participants in the IETF id-event
      mailing list and related working groups for their support of this specification.</t>
    </section>

    <section anchor="History" title="Change Log">
      <t>Draft 01 - PH - Renamed eventUris to events</t>
      <t>Draft 00 - PH - First Draft</t>
      <t>Draft 01 - PH - Fixed some alignment issues with JWT. Remove event type attribute.</t>
      <t>Draft 02 - PH - Renamed to Security Events, Removed questions, clarified examples and intro text, and added security and privacy section.</t>
      <t>Draft 03 - PH <list style="symboles">
        <t>General edit corrections from Sarah Squire</t>
        <t>Changed "event" term to "SET"</t>
        <t>Corrected author organization for William Denniss to Google</t>
        <t>Changed definition of SET to be 2 parts, an envelope and 1 or more payloads.</t>
        <t>Clarified that the intent is to express a single event with optional extensions only.</t>
      </list>
                  - mbj - Registered <spanx style="verb">events</spanx> claim, and proof-reading corrections.</t> 
      <t>Draft 04 - PH - <list style="symbols">
        <t>Re-added the "sub" claim with clarifications that any SET type may use it.</t>
        <t>Added additional clarification on the use of envelope vs. payload attributes</t>
        <t>Added security consideration for event timing.</t>
        <t>Switched use of "attribute" to "claim" for consistency.</t>
        <t>Revised examples to put "sub" claim back in the top level.</t>
        <t>Added clarification that SETs typically do not use "exp".</t>
        <t>Added security consideration for distinguishing Access Tokens and SETs.</t>
      </list></t>
      
      <t>Draft 05 - PH - Fixed find/replace error that resulted in claim being spelled claimc</t>
      <t>Draft 06 - PH - <list style="symbols">
        <t>Corrected typos</t>
        <t>New txn claim</t>
        <t>New security considerations Sequencing and Timing Issues</t>
      </list></t>
  
    </section>
  </back>
</rfc>
