1# coding: utf-8 2# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. 3# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. 4 5from .authentication_policy import AuthenticationPolicy 6from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 7from oci.decorators import init_model_state_from_kwargs 8 9 10@init_model_state_from_kwargs 11class CustomAuthenticationPolicy(AuthenticationPolicy): 12 """ 13 Use a function to validate a custom header or query parameter sent with the request authentication. 14 A valid policy must specify either tokenHeader or tokenQueryParam. 15 """ 16 17 def __init__(self, **kwargs): 18 """ 19 Initializes a new CustomAuthenticationPolicy object with values from keyword arguments. The default value of the :py:attr:`~oci.apigateway.models.CustomAuthenticationPolicy.type` attribute 20 of this class is ``CUSTOM_AUTHENTICATION`` and it should not be changed. 21 The following keyword arguments are supported (corresponding to the getters/setters of this class): 22 23 :param is_anonymous_access_allowed: 24 The value to assign to the is_anonymous_access_allowed property of this CustomAuthenticationPolicy. 25 :type is_anonymous_access_allowed: bool 26 27 :param type: 28 The value to assign to the type property of this CustomAuthenticationPolicy. 29 Allowed values for this property are: "CUSTOM_AUTHENTICATION", "JWT_AUTHENTICATION" 30 :type type: str 31 32 :param function_id: 33 The value to assign to the function_id property of this CustomAuthenticationPolicy. 34 :type function_id: str 35 36 :param token_header: 37 The value to assign to the token_header property of this CustomAuthenticationPolicy. 38 :type token_header: str 39 40 :param token_query_param: 41 The value to assign to the token_query_param property of this CustomAuthenticationPolicy. 42 :type token_query_param: str 43 44 """ 45 self.swagger_types = { 46 'is_anonymous_access_allowed': 'bool', 47 'type': 'str', 48 'function_id': 'str', 49 'token_header': 'str', 50 'token_query_param': 'str' 51 } 52 53 self.attribute_map = { 54 'is_anonymous_access_allowed': 'isAnonymousAccessAllowed', 55 'type': 'type', 56 'function_id': 'functionId', 57 'token_header': 'tokenHeader', 58 'token_query_param': 'tokenQueryParam' 59 } 60 61 self._is_anonymous_access_allowed = None 62 self._type = None 63 self._function_id = None 64 self._token_header = None 65 self._token_query_param = None 66 self._type = 'CUSTOM_AUTHENTICATION' 67 68 @property 69 def function_id(self): 70 """ 71 **[Required]** Gets the function_id of this CustomAuthenticationPolicy. 72 The `OCID`__ of the Oracle Functions function resource. 73 74 __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm 75 76 77 :return: The function_id of this CustomAuthenticationPolicy. 78 :rtype: str 79 """ 80 return self._function_id 81 82 @function_id.setter 83 def function_id(self, function_id): 84 """ 85 Sets the function_id of this CustomAuthenticationPolicy. 86 The `OCID`__ of the Oracle Functions function resource. 87 88 __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm 89 90 91 :param function_id: The function_id of this CustomAuthenticationPolicy. 92 :type: str 93 """ 94 self._function_id = function_id 95 96 @property 97 def token_header(self): 98 """ 99 Gets the token_header of this CustomAuthenticationPolicy. 100 The name of the header containing the authentication token. 101 102 103 :return: The token_header of this CustomAuthenticationPolicy. 104 :rtype: str 105 """ 106 return self._token_header 107 108 @token_header.setter 109 def token_header(self, token_header): 110 """ 111 Sets the token_header of this CustomAuthenticationPolicy. 112 The name of the header containing the authentication token. 113 114 115 :param token_header: The token_header of this CustomAuthenticationPolicy. 116 :type: str 117 """ 118 self._token_header = token_header 119 120 @property 121 def token_query_param(self): 122 """ 123 Gets the token_query_param of this CustomAuthenticationPolicy. 124 The name of the query parameter containing the authentication token. 125 126 127 :return: The token_query_param of this CustomAuthenticationPolicy. 128 :rtype: str 129 """ 130 return self._token_query_param 131 132 @token_query_param.setter 133 def token_query_param(self, token_query_param): 134 """ 135 Sets the token_query_param of this CustomAuthenticationPolicy. 136 The name of the query parameter containing the authentication token. 137 138 139 :param token_query_param: The token_query_param of this CustomAuthenticationPolicy. 140 :type: str 141 """ 142 self._token_query_param = token_query_param 143 144 def __repr__(self): 145 return formatted_flat_dict(self) 146 147 def __eq__(self, other): 148 if other is None: 149 return False 150 151 return self.__dict__ == other.__dict__ 152 153 def __ne__(self, other): 154 return not self == other 155