Open Exchange
Global Masters
Home / Class Reference / %SYS namespace / %OAuth2.Utils
Private  Storage   


class %OAuth2.Utils extends

Utility methods for OAuth 2.0 support. This class is used internally by Caché. You should not make direct use of it within your applications. There is no guarantee made about either the behavior or future operation of this class.


Parameters Properties Methods Queries Indices ForeignKeys Triggers


%%OIDGet %AddToSaveSet %BindExport %BuildObjectGraph
%ClassIsLatestVersion %ClassName %Close %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Extends
%GetParameter %IncrementCount %IsA %IsModified
%New %NormalizeObject %ObjectModified %OriginalNamespace
%PackageName %RemoveFromSaveSet %SerializeObject %SetModified
%ValidateObject Base64UrlDecode Base64UrlEncode CheckScope
CommaToList DisplayLog GetDefaultSessionId GetJSONvalue
IsAlgRSA IsAlgSymmetric ListToComma LogArray
LogCSPRequest LogCurrentSesssion LogError LogHTTPRequest
LogHTTPResponse LogJSON LogJWKS LogServerScope
LogServerToken NormalizeScope ObjectToJSON SelectLanguage
TimeInH TimeInSeconds UpdatePrivateJWKS


• classmethod Base64UrlDecode(text As %String) as %Binary
Decode base64url encoded string
• classmethod Base64UrlEncode(bin As %Binary) as %String
Encode binary value using base64url encoding
• classmethod CheckScope(tokenScope As %String, scope As %String) as %OAuth2.Error
Check that scope is subset of valid scopes for this token
• classmethod CommaToList(str As %String) as %List
Convert a comma separated list to a $list
• classmethod DisplayLog(file As %String = "oauth2.log", testMode As %Boolean = 0)
Display ^%ISCLOG
• classmethod GetDefaultSessionId(ByRef sessionId As %String) as %String
Get the default sessionId if none is specified.
• classmethod GetJSONvalue(prop As %String, type As %String) as %String
Needed for internal code generators.
• classmethod IsAlgRSA(alg As %String) as %Boolean
Check if apecified algorithm is RSA algorithm
• classmethod IsAlgSymmetric(alg As %String) as %Boolean
Check if apecified algorithm is symmetric
• classmethod ListToComma(list As %List) as %String
Convert a $list to comman separated list
• classmethod LogArray(methodName As %String, server As %Boolean, desc As %String, ByRef array)
Log a local array
• classmethod LogCSPRequest(methodName As %String, server As %Boolean)
Log details of HTTP request received by CSP
• classmethod LogCurrentSesssion(methodName As %String)
Log the current session.
• classmethod LogError(methodName As %String, server As %Boolean, sc As %Status, data As %String)
Log an OAuth 2.0 error
• classmethod LogHTTPRequest(methodName As %String, server As %Boolean, httpRequest As %Net.HttpRequest, method As %String, url As %String, ByRef formData)
Log details of HTTP request to be made
• classmethod LogHTTPResponse(methodName As %String, server As %Boolean, httpRequest As %Net.HttpRequest)
Log details of HTTP response
• classmethod LogJSON(methodName As %String, server As %Boolean, desc As %String, json As %DynamicObject)
Log a JSON object
• classmethod LogJWKS(methodName As %String, server As %Boolean, desc As %String, jwks As %DynamicObject)
Log a JWKS
• classmethod LogServerScope(methodName As %String, token As OAuth2.Server.AccessToken)
Log a server token
• classmethod LogServerToken(methodName As %String, token As OAuth2.Server.AccessToken)
Log a server token
• classmethod NormalizeScope(scope As %String) as %String
Normalize scope
• classmethod ObjectToJSON(object As %DynamicAbstractObject) as %Status
Output JSON object to the current device
• classmethod SelectLanguage(uiLocales As %String, domain As %String) as %String
Select the language for Authentication Class localization.
uiLocales is the value of the ui_locales request parameter.
The return value is the selected language code.
Call looks like: Set language=##class(%OAuth2.Utils).SelectLanguage(properties.RequestProperties.GetAt("ui_locales"),domain)
• classmethod TimeInH(time As %Integer) as %String
Convert seconds since start of the Unix epoch to $h format.
• classmethod TimeInSeconds(time As %String, interval As %Integer = 0) as %Integer
Convert $h value to seconds since start of the Unix epoch,
time is $h value.
interval is interval to be added in seconds.
• classmethod UpdatePrivateJWKS(ByRef privateJWKS As %String, ByRef publicJWKS As %String) as %Status
Update the private JWKS for client or authorization server with a new private/public key pair or each supported algorithm. UpdatePrivateJWKS is used to initially create the JWKS or to do key rotation.