Skip to main content

%OAuth2.Utils

Class %OAuth2.Utils Extends %RegisteredObject [ System = 3 ]

Utility methods for OAuth 2.0 support. This class is used internally by InterSystems IRIS. 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.

Methods

Base64UrlEncode

ClassMethod Base64UrlEncode(bin As %Binary) As %String [ CodeMode = expression ]

Encode binary value using base64url encoding

Base64UrlDecode

ClassMethod Base64UrlDecode(text As %String) As %Binary [ CodeMode = expression ]

Decode base64url encoded string

TimeInSeconds

ClassMethod TimeInSeconds(time As %String, interval As %Integer = 0) As %Integer [ Internal ]

Convert $h value to seconds since start of the Unix epoch,
time is $h value.
interval is interval to be added in seconds.

TimeInH

ClassMethod TimeInH(time As %Integer) As %String [ Internal ]

Convert seconds since start of the Unix epoch to $h format.

IsAlgSymmetric

ClassMethod IsAlgSymmetric(alg As %String) As %Boolean [ Deprecated ]

Check if apecified algorithm is symmetric This method is deprecated. Use the IsAlgSymmetric method in %Net.JSON.JWA instead.

IsAlgRSA

ClassMethod IsAlgRSA(alg As %String) As %Boolean [ Deprecated ]

Check if specified algorithm is RSA algorithm This method is deprecated. Use the IsAlgRSA method in %Net.JSON.JWA instead.

IsAlgEC

ClassMethod IsAlgEC(alg As %String) As %Boolean [ Deprecated ]

Check if specified algorithm is EC algorithm This method is deprecated. Use the IsAlgEC method in %Net.JSON.JWA instead.

GetSupportedAlgorithms

ClassMethod GetSupportedAlgorithms(Output sigalgs As %List, Output encalgs As %List, Output keyalgs As %List)

UpdatePrivateJWKS

ClassMethod UpdatePrivateJWKS(ByRef privateJWKS As %String, ByRef publicJWKS As %String) As %Status [ Internal ]

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.

FindLastKid

ClassMethod FindLastKid(jwks As %String) As %Integer

GetSecurityParams

ClassMethod GetSecurityParams(ops As %DynamicObject, Output securityParams) [ Internal ]

CommaToList

ClassMethod CommaToList(str As %String) As %List

Convert a comma separated list to a $list

ListToComma

ClassMethod ListToComma(list As %List) As %String

Convert a $list to comman separated list

CheckScope

ClassMethod CheckScope(tokenScope As %String, scope As %String) As %OAuth2.Error

Check that scope is subset of valid scopes for this token

NormalizeScope

ClassMethod NormalizeScope(scope As %String) As %String [ Internal ]

Normalize scope

SelectLanguage

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)

GetDefaultSessionId

ClassMethod GetDefaultSessionId(ByRef sessionId As %String) As %String [ Internal ]

Get the default sessionId if none is specified.

ObjectToJSON

ClassMethod ObjectToJSON(object As %DynamicAbstractObject) As %Status

Output JSON object to the current device

LogError

ClassMethod LogError(methodName As %String, server As %Boolean, sc As %Status, data As %String) [ Internal ]

Log an OAuth 2.0 error

LogCSPRequest

ClassMethod LogCSPRequest(methodName As %String, server As %Boolean) [ Internal ]

Log details of HTTP request received by CSP

LogHTTPRequest

ClassMethod LogHTTPRequest(methodName As %String, server As %Boolean, httpRequest As %Net.HttpRequest, method As %String, url As %String, ByRef formData, logLevel As %Integer = 3) [ Internal ]

Log details of HTTP request to be made

LogHTTPResponse

ClassMethod LogHTTPResponse(methodName As %String, server As %Boolean, httpRequest As %Net.HttpRequest, logLevel As %Integer = 3) [ Internal ]

Log details of HTTP response

LogServerToken

ClassMethod LogServerToken(methodName As %String, token As OAuth2.Server.AccessToken) [ Internal ]

Log a server token

LogServerScope

ClassMethod LogServerScope(methodName As %String, token As OAuth2.Server.AccessToken) [ Internal ]

Log a server token

LogArray

ClassMethod LogArray(methodName As %String, server As %Boolean, desc As %String, ByRef array) [ Internal ]

Log a local array

LogJSON

ClassMethod LogJSON(methodName As %String, server As %Boolean, desc As %String, json As %DynamicObject) [ Internal ]

Log a JSON object

DisplayLog

ClassMethod DisplayLog(file As %String = "oauth2.log", testMode As %Boolean = 0) [ Internal ]

Display ^ISCLOG

GetJSONvalue

ClassMethod GetJSONvalue(prop As %String, type As %String) As %String [ Internal ]

Needed for internal code generators.

GetJSONResponse

ClassMethod GetJSONResponse(httpRequest As %Net.HttpRequest, Output json As %DynamicObject, Output error As %OAuth2.Error) As %Status [ Final, Internal ]

Get the response object Called by OAuth2.Response and %SYS.OAuth2.AccessToken