docs.intersystems.com
Home  /  Security Features of InterSystems IRIS  /  Security Tutorial  /  Code for Authentication Example


Security Tutorial
Code for Authentication Example
[Back]  [Next] 
InterSystems: The power behind what matters   
Search:  


Here is the code for the authentication example. Create the class using Atelier.
Class SecurityTutorial.AuthenticationExample Extends %CSP.REST
{
XData UrlMap 
{
    <Routes>
        <Route Url="/authenticationEx" Method="Get" Call="authenticationEx"/>

    </Routes>
}

ClassMethod authenticationEx() As %Status 
{
      
    Set %response.Status = ..#HTTP200OK
    
    Set obj={
    
        "username":($UserName),
        "roles":($Roles)
    }
    
    Write obj.%ToJSON()
    
    Return $$$OK
}
}
Note:
For more information about Atelier, including instructions for downloading and installing, as well as videos and tutorials on how to use it, see Atelier Download