@@ -71,7 +71,7 @@ uploads an image.
71
71
{operation_id :: operation_id (),
72
72
accept_callback :: openapi_logic_handler :accept_callback (),
73
73
provide_callback :: openapi_logic_handler :provide_callback (),
74
- api_key_handler :: openapi_logic_handler :api_key_callback (),
74
+ api_key_callback :: openapi_logic_handler :api_key_callback (),
75
75
context = #{} :: openapi_logic_handler :context ()}).
76
76
77
77
-type state () :: # state {}.
@@ -87,7 +87,7 @@ init(Req, {Operations, Module}) ->
87
87
State = # state {operation_id = OperationID ,
88
88
accept_callback = fun Module :accept_callback /4 ,
89
89
provide_callback = fun Module :provide_callback /4 ,
90
- api_key_handler = fun Module :authorize_api_key /2 },
90
+ api_key_callback = fun Module :api_key_callback /2 },
91
91
{cowboy_rest , Req , State }.
92
92
93
93
-spec allowed_methods (cowboy_req :req (), state ()) ->
@@ -115,71 +115,71 @@ allowed_methods(Req, State) ->
115
115
{true | {false , iodata ()}, cowboy_req :req (), state ()}.
116
116
is_authorized (Req0 ,
117
117
# state {operation_id = 'addPet' = OperationID ,
118
- api_key_handler = Handler } = State ) ->
119
- case openapi_auth :authorize_api_key (Handler , OperationID , header , " authorization" , Req0 ) of
118
+ api_key_callback = Handler } = State ) ->
119
+ case openapi_auth :authorize_api_key (Handler , OperationID , header , << " authorization" >> , Req0 ) of
120
120
{true , Context , Req } ->
121
121
{true , Req , State # state {context = Context }};
122
122
{false , AuthHeader , Req } ->
123
123
{{false , AuthHeader }, Req , State }
124
124
end ;
125
125
is_authorized (Req0 ,
126
126
# state {operation_id = 'deletePet' = OperationID ,
127
- api_key_handler = Handler } = State ) ->
128
- case openapi_auth :authorize_api_key (Handler , OperationID , header , " authorization" , Req0 ) of
127
+ api_key_callback = Handler } = State ) ->
128
+ case openapi_auth :authorize_api_key (Handler , OperationID , header , << " authorization" >> , Req0 ) of
129
129
{true , Context , Req } ->
130
130
{true , Req , State # state {context = Context }};
131
131
{false , AuthHeader , Req } ->
132
132
{{false , AuthHeader }, Req , State }
133
133
end ;
134
134
is_authorized (Req0 ,
135
135
# state {operation_id = 'findPetsByStatus' = OperationID ,
136
- api_key_handler = Handler } = State ) ->
137
- case openapi_auth :authorize_api_key (Handler , OperationID , header , " authorization" , Req0 ) of
136
+ api_key_callback = Handler } = State ) ->
137
+ case openapi_auth :authorize_api_key (Handler , OperationID , header , << " authorization" >> , Req0 ) of
138
138
{true , Context , Req } ->
139
139
{true , Req , State # state {context = Context }};
140
140
{false , AuthHeader , Req } ->
141
141
{{false , AuthHeader }, Req , State }
142
142
end ;
143
143
is_authorized (Req0 ,
144
144
# state {operation_id = 'findPetsByTags' = OperationID ,
145
- api_key_handler = Handler } = State ) ->
146
- case openapi_auth :authorize_api_key (Handler , OperationID , header , " authorization" , Req0 ) of
145
+ api_key_callback = Handler } = State ) ->
146
+ case openapi_auth :authorize_api_key (Handler , OperationID , header , << " authorization" >> , Req0 ) of
147
147
{true , Context , Req } ->
148
148
{true , Req , State # state {context = Context }};
149
149
{false , AuthHeader , Req } ->
150
150
{{false , AuthHeader }, Req , State }
151
151
end ;
152
152
is_authorized (Req0 ,
153
153
# state {operation_id = 'getPetById' = OperationID ,
154
- api_key_handler = Handler } = State ) ->
155
- case openapi_auth :authorize_api_key (Handler , OperationID , header , " authorization" , Req0 ) of
154
+ api_key_callback = Handler } = State ) ->
155
+ case openapi_auth :authorize_api_key (Handler , OperationID , header , << " authorization" >> , Req0 ) of
156
156
{true , Context , Req } ->
157
157
{true , Req , State # state {context = Context }};
158
158
{false , AuthHeader , Req } ->
159
159
{{false , AuthHeader }, Req , State }
160
160
end ;
161
161
is_authorized (Req0 ,
162
162
# state {operation_id = 'updatePet' = OperationID ,
163
- api_key_handler = Handler } = State ) ->
164
- case openapi_auth :authorize_api_key (Handler , OperationID , header , " authorization" , Req0 ) of
163
+ api_key_callback = Handler } = State ) ->
164
+ case openapi_auth :authorize_api_key (Handler , OperationID , header , << " authorization" >> , Req0 ) of
165
165
{true , Context , Req } ->
166
166
{true , Req , State # state {context = Context }};
167
167
{false , AuthHeader , Req } ->
168
168
{{false , AuthHeader }, Req , State }
169
169
end ;
170
170
is_authorized (Req0 ,
171
171
# state {operation_id = 'updatePetWithForm' = OperationID ,
172
- api_key_handler = Handler } = State ) ->
173
- case openapi_auth :authorize_api_key (Handler , OperationID , header , " authorization" , Req0 ) of
172
+ api_key_callback = Handler } = State ) ->
173
+ case openapi_auth :authorize_api_key (Handler , OperationID , header , << " authorization" >> , Req0 ) of
174
174
{true , Context , Req } ->
175
175
{true , Req , State # state {context = Context }};
176
176
{false , AuthHeader , Req } ->
177
177
{{false , AuthHeader }, Req , State }
178
178
end ;
179
179
is_authorized (Req0 ,
180
180
# state {operation_id = 'uploadFile' = OperationID ,
181
- api_key_handler = Handler } = State ) ->
182
- case openapi_auth :authorize_api_key (Handler , OperationID , header , " authorization" , Req0 ) of
181
+ api_key_callback = Handler } = State ) ->
182
+ case openapi_auth :authorize_api_key (Handler , OperationID , header , << " authorization" >> , Req0 ) of
183
183
{true , Context , Req } ->
184
184
{true , Req , State # state {context = Context }};
185
185
{false , AuthHeader , Req } ->
0 commit comments