Creating Accounts and Users

 

Authors: Stephanie Groot, Neustar; Jim Taylor and Albert Koval, DECE

 

This article explains how to create new Accounts and Users and recommends practices for a simple user experience.

To streamline entry into the UltraViolet ecosystem, certain Nodes (Retailers, LASPs<, and Access Portals) can provide a custom interface to help users easily create a new UltraViolet Account and User. This can happen at the same time the user is signing up for a new account at the Node's own service, or can be offered to users who already have an account at the Node.

See IUX Best Practices for additional guidelines on how to design account creation and account linking user interfaces.

Requirements and Options

Minimum user data that must be provided:

Optional data

Obsolete elements:

*Last name required as of Coordinator 1.0.4 (July 2012)

Flow for Creating an Account and Initial User

*Feature added in Coordinator 1.0.4 (July 2012)

1Feature added in Coordinator 1.0.4 (July 2012)

2Feature added in Coordinator 1.0.5 (October 2012)

3Node collection of TOU acceptance first allowed in Coordinator 1.0.4 (July 2012)

See the Account creation pseudo code below

More Information

For more on Account linking, see Linking and Security Tokens.

 

Examples:
/*
resource property query status:
300 Multiple Choices – the search matched more than one resource. No disambiguation information will be provided.
 This will only be returned for queries targeting PrimaryEmail, and only if the email address is associated with more than one account.
302 Found - the search matched an existing entry for the targeted resource type.
400 Bad Request - the XPath expression is not valid, or the request cannot otherwise be fulfilled.
403 Forbidden - the Node is not allowed to perform this request.
404 Not Found – the search did not yield any match.
*/

/* within new account submission form */

/* check if email already in use in UltraViolet */
on form.email_address.update {
        if(dcoord.resourcepropertyquery(PrimaryEmail, form.email_address).status == 300|302){
                /* email already registered.
                   prompt user "Looks like you already have an UltraViolet account, please sign in; or
continue to create a new UltraViolet account." */
        }elseif(dcoord.resourcepropertyquery(PrimaryEmail, form.email_address).status == 404){
                /* email not in use, no action (or show an "input accepted" icon next to field) */
        }else{
                /* handle error */
        }
}

/* check if username available */
on form.username.update {
        if (dcoord.resourcepropertyquery(Username, form.username).status == 302){
                /* prompt user for different username or offer option to sign in to UltraViolet */
        }elseif (dcoord.resourcepropertyquery(Username, form.username).status == 404){
                /* the username is available, no action (or show an "input accepted" icon next to field) */
        }else{
                /* handle error */
        }
}


user = create(
        DisplayName = Smith Household,
        Country = US;
        Username = timmy,
        Password = foobar123,
        PrimaryEmail = timmy@example.biz,
        GivenName = Timmy,
        SurName = Smith
);


/* ready to create account and user from information collected in new account form or previously collected  or create an account and user in one call*/
/* all information needed to create both an account and a user should be collected before beginning this process */


userresource = dcoord.AccountUserCreate(user);

while(userresource.status != 201){
        /* error handling. potentially reprompt user for corrections
        /* Error codes:
        AccountUsernameRegistered                       Username already Registered                     400
        AccountActiveUserCountReachedMaxLimit           Active User Count has reached the maximum limit 401
        AccountUserPrivilegeInsufficient                Requestor Privilege Insufficient                403
        AccountUserCannotPromoteUserToHigherPrivilege   Creating User may only promote user to the      403
                                                        same privilege as the creating user    
        AccountUserAccountIdNotFound                    Account Id not found                            404
        AccountStatusInvalid                            Account Status Invalid                          400
        */

        userresource = dcoord.AccountUserCreate(user)
}

/* user created */

/* fetch DST */
shortdst = dcoord.securitytokenservice(usercredentials)
Template for AccountUserCreate

HTTP/1.1 201 Created
Date: Tue, 18 Feb 2014 20:08:56 GMT
Server: Apache
Location: https://iot2.p.uvvu.com:7001/rest/1/11/Account/urn:dece:accountid:org:dece:98C61D79D9644410751EAF34C13BADA8/User/urn:dece:userid:org:dece:A8C61D79D9644410751EAF34C13BADA8
x-Transaction-Info: t=1392754137 UwO92ApaMpMAAGlbJOoAAAAP urn:dece:org:org:dece:iot2:emulator:org1:node1 156.154.122.229
Content-Length: 0
Vary: Accept-Encoding
Content-Type: application/xml;charset=UTF-8
Template for AccountUserCreate:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Account xmlns="http://www.decellc.org/schema/2013/10/coordinator" xmlns:ns2="http://www.movielabs.com/md" xmlns:ns3="http://www.w3.org/2000/09/xmldsig#" xmlns:ns4="http://www.w3.org/2001/04/xmlenc#">
        <DisplayName>NAME TO DISPLAY</DisplayName>
        <Country>US</Country>
        <UserList>
                <User UserClass="urn:dece:role:user:class:full" xmlns="http://www.decellc.org/schema/2013/10/coordinator" xmlns:ns2="http://www.movielabs.com/md" xmlns:ns3="http://www.w3.org/2000/09/xmldsig#" xmlns:ns4="http://www.w3.org/2001/04/xmlenc#">
                        <Name>
                                <GivenName>FIRST NAME</GivenName>
                                <SurName>LAST NAME</SurName>
                        </Name>
                        <ContactInfo>  
                                <PrimaryEmail>
                                        <Value>EMAIL@EMAIL.COM</Value>        
                                        <ConfirmationEndpoint>confirmed</ConfirmationEndpoint>
                                </PrimaryEmail>
                                 <AlternateEmail>    
                                        <Value>ALT-EMAIL@EMAIL.COM</Value>      
                                        <ConfirmationEndpoint>confirmed</ConfirmationEndpoint>  
                                </AlternateEmail>
                        </ContactInfo>
                        <Languages>
                                <Language>EN-US</Language>
                        </Languages>
                        <Credentials>
                                <Username>marykowalski</Username>    
                                <Password>gre-BnU-127-zY3</Password>
                        </Credentials>
                </User>
        </UserList>
</Account>
Example ResourcePropertyQuery request to check for an existing user associated with the provided email address:

POST https://iot2.p.uvvu.com:7001/rest/1/11/Info HTTP/1.1
Content-Type: application/xml
Content-Length: 37
Host: iot2.p.uvvu.com:7001
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
 
//User[Credentials[Username='Craig']]
 
HTTP/1.1 404 Not Found
Date: Wed, 23 Jul 2014 21:22:25 GMT
Server: Apache
Set-Cookie: JSESSIONID=10gi36bxo29l31ge98j2n1o7f.api1;Path=/rest/1/11;Secure
Expires: Thu, 01 Jan 1970 00:00:00 GMT
x-Transaction-Info: t=1406150546 U9AnkQofmIgAAD13RP4AAAA7 urn:dece:org:org:dece:RET 10.31.153.241
Vary: Accept-Encoding
Content-Length: 615
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: application/xml;charset=UTF-8
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ErrorList xmlns="http://www.decellc.org/schema/2013/10/coordinator" xmlns:ns2="http://www.movielabs.com/schema/md/v2.1/md" xmlns:ns3="http://www.w3.org/2000/09/xmldsig#" xmlns:ns4="http://www.w3.org/2001/04/xmlenc#">
    <Error ErrorID="urn:dece:errorid:org:dece:NotFound">
        <Reason Language="en">The requested resource was not found.</Reason>
        <OriginalRequest>https://iot2.p.uvvu.com/rest/1/11/Info</OriginalRequest>
        <ErrorLink>https://iot2.q.uvvu.com:7001/rest/1/11/error/en/ErrorList.html#NotFound</ErrorLink>
    </Error>
</ErrorList>
Example ResourcePropertyQuery request to ensure the username is available
POST https://iot2.p.uvvu.com:7001/rest/1/11/Info HTTP/1.1
Content-Type: application/xml
Content-Length: 53
Host: iot2.p.uvvu.com:7001
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
 
//User[Credentials/Username[matches(.,'.........')]]
 
HTTP/1.1 404 Not Found

Date: Wed, 23 Jul 2014 21:24:23 GMT
Server: Apache
Set-Cookie: JSESSIONID=1apyhtv5x65yc15xsq4432xdng.api3;Path=/rest/1/11;Secure
Expires: Thu, 01 Jan 1970 00:00:00 GMT
x-Transaction-Info: t=1406150677 U9AoBwofmIgAADouKcQAAAAT urn:dece:org:org:dece:RET 10.31.153.241
Vary: Accept-Encoding
Content-Length: 615
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: application/xml;charset=UTF-8
 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ErrorList xmlns="http://www.decellc.org/schema/2013/10/coordinator" xmlns:ns2="http://www.movielabs.com/schema/md/v2.1/md" xmlns:ns3="http://www.w3.org/2000/09/xmldsig#" xmlns:ns4="http://www.w3.org/2001/04/xmlenc#">
    <Error ErrorID="urn:dece:errorid:org:dece:NotFound">
        <Reason Language="en">The requested resource was not found.</Reason>
        <OriginalRequest>https://iot.p.uvvu.com/rest/1/11/Info</OriginalRequest>
        <ErrorLink>https://iot.q.uvvu.com/rest/1/11/error/en/ErrorList.html#NotFound</ErrorLink>
    </Error>
</ErrorList>