PolicyAdvice

@objc
public class PolicyAdvice : NSObject

PolicyAdvice is a representation of Authorization Policy advice response from AM’s policy engine

Property

  • AdviceType of the PolicyAdvice

    Declaration

    Swift

    public var type: AdviceType
  • Advice value (transactionId, or AuthenticationTree name)

    Declaration

    Swift

    public var value: String
  • Optional transactionId; only available for transactional authorization

    Declaration

    Swift

    public var txId: String?

Init

  • Initializes PolicyAdvice object with URL; PolicyAdvice class extracts certain information fromt he redirect-url, and construct the object

    Declaration

    Swift

    @objc
    public init?(redirectUrl: String)

    Parameters

    redirectUrl

    redirectURL string value from the response header

  • Initializes PolicyAdvice object with JSON payload; JSON playload should be in following format and should be the same format that AM returns for policy evaluation.

     {
        "resource": "http://www.example.com:8000/index.html",
        "actions": {},
        "attributes": {},
        "advices": {
            "TransactionConditionAdvice": [
                "9dae2c80-fe7a-4a36-b57b-4fb1271b0687"
            ]
        },
        "ttl": 0
     }
    

    Declaration

    Swift

    @objc
    public init?(json: [String : Any])
  • Initializes PolicyAdvice object with authorization policy type, and value. With example JSON payload shown below, ‘TransactionConditionAdvice’ is type of PolicyAdvice, and ‘9dae2c80-fe7a-4a36-b57b-4fb1271b0687’ is value of PolicyAdvice

     {
        "resource": "http://www.example.com:8000/index.html",
        "actions": {},
        "attributes": {},
        "advices": {
            "TransactionConditionAdvice": [
                "9dae2c80-fe7a-4a36-b57b-4fb1271b0687"
            ]
        },
        "ttl": 0
     }
    

    Declaration

    Swift

    @objc
    public init?(type: String,
                 value: String,
                 authIndexType: String? = nil,
                 authIndexValue: String? = nil)