Skip to main content

Code for Authentication Example

Here is the code for the authentication example. Create the class using your IDE.


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
}
}
FeedbackOpens in a new tab