Skip to content

Commit

Permalink
Fix bearer proto security definitions
Browse files Browse the repository at this point in the history
Add correct security definition for JWT Authorization token
headers so that swagger file is generated correctly.
  • Loading branch information
sesposito committed Feb 10, 2023
1 parent 4170087 commit 989f52b
Show file tree
Hide file tree
Showing 16 changed files with 638 additions and 47 deletions.
25 changes: 13 additions & 12 deletions apigrpc/apigrpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions apigrpc/apigrpc.proto
Expand Up @@ -58,10 +58,11 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
}
}
security: {
// Made up security so we can apply "Bearer <JWT_TOKEN>"
key: "BearerJwt";
key: "BearerJwt"
value: {
type: TYPE_INVALID;
type: TYPE_API_KEY
in: IN_HEADER
name: "Authorization"
}
}
security: {
Expand Down
4 changes: 3 additions & 1 deletion apigrpc/apigrpc.swagger.json
Expand Up @@ -5225,7 +5225,9 @@
"type": "basic"
},
"BearerJwt": {
"type": ""
"type": "apiKey",
"name": "Authorization",
"in": "header"
},
"HttpKeyAuth": {
"type": "apiKey",
Expand Down
23 changes: 12 additions & 11 deletions console/console.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions console/console.proto
Expand Up @@ -55,9 +55,12 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
}
}
security: {
// Made up security so we can apply "Bearer <JWT_TOKEN>"
key: "BearerJwt";
value: {};
key: "BearerJwt"
value: {
type: TYPE_API_KEY
in: IN_HEADER
name: "Authorization"
}
}
}
// Default security definition.
Expand Down
4 changes: 3 additions & 1 deletion console/console.swagger.json
Expand Up @@ -4063,7 +4063,9 @@
"type": "basic"
},
"BearerJwt": {
"type": ""
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
},
"security": [
Expand Down
2 changes: 1 addition & 1 deletion console/ui/dist/prod-nt/index.html
Expand Up @@ -10,5 +10,5 @@
<link rel="stylesheet" href="static/styles.14b882f135e080634619.css"></head>
<body class="h-100">
<app-root></app-root>
<script src="static/runtime.4ced225923cd14368d64.js" defer=""></script><script src="static/polyfills.cb4331e883de4daa4c94.js" defer=""></script><script src="static/main.8e218c242568953c057c.js" defer=""></script></body>
<script src="static/runtime.4ced225923cd14368d64.js" defer=""></script><script src="static/polyfills.cb4331e883de4daa4c94.js" defer=""></script><script src="static/main.2a180007707cc9b3ebfc.js" defer=""></script></body>
</html>

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion console/ui/dist/prod/index.html
Expand Up @@ -10,5 +10,5 @@
<link rel="stylesheet" href="static/styles.14b882f135e080634619.css"></head>
<body class="h-100">
<app-root></app-root>
<script src="static/runtime.4ced225923cd14368d64.js" defer=""></script><script src="static/polyfills.cb4331e883de4daa4c94.js" defer=""></script><script src="static/main.fccf1eefb431fad17814.js" defer=""></script></body>
<script src="static/runtime.4ced225923cd14368d64.js" defer=""></script><script src="static/polyfills.cb4331e883de4daa4c94.js" defer=""></script><script src="static/main.560bf34df228ded4297b.js" defer=""></script></body>
</html>

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions console/ui/src/app/account/purchases/purchases.component.html
Expand Up @@ -25,10 +25,11 @@ <h6 class="mr-2 d-inline font-weight-bold">Error while processing request: {{err
<th>Store</th>
<th style="width: 180px">Purchase Time</th>
<th style="width: 180px">Create Time</th>
<th style="width: 180px">Refund Time</th>
</tr>
</thead>
<tbody>
<ng-template ngFor let-i="index" let-p [ngForOf]="purchases">
<ng-template ngFor let-i="index" let-p [ngForOf]="purchases">
<tr>
<td>
<div class="arrow" (click)="purchasesRowsOpen[i]=!purchasesRowsOpen[i];">
Expand All @@ -41,9 +42,10 @@ <h6 class="mr-2 d-inline font-weight-bold">Error while processing request: {{err
<td>{{getStoreText(p.store)}}</td>
<td>{{p.purchase_time}}</td>
<td>{{p.create_time}}</td>
<td>{{p.refund_time}}</td>
</tr>
<tr *ngIf="purchasesRowsOpen[i]" class="open-row">
<td colspan="7">
<td colspan="6">
<div class="p-2">
<div><small><b>Provider Response</b></small></div>
<div>
Expand All @@ -53,7 +55,7 @@ <h6 class="mr-2 d-inline font-weight-bold">Error while processing request: {{err
</td>
</tr>
</ng-template>
<tr *ngIf="purchases.length === 0"><td colspan="5" class="text-muted">No purchases were found.</td></tr>
<tr *ngIf="purchases.length === 0"><td colspan="6" class="text-muted">No purchases were found.</td></tr>
</tbody>
</table>
</div>
Expand Up @@ -26,20 +26,41 @@ <h6 class="mr-2 d-inline font-weight-bold">Error while processing request: {{err
<th style="width: 180px">Purchase Time</th>
<th style="width: 180px">Expiry Time</th>
<th style="width: 180px">Create Time</th>
<th style="width: 180px">Refund Time</th>
</tr>
</thead>
<tbody>
<ng-template ngFor let-i="index" let-p [ngForOf]="subscriptions">
<ng-template ngFor let-i="index" let-p [ngForOf]="subscriptions">
<tr>
<td>{{p.product_id}}</td>
<td>
<div class="arrow" (click)="subscriptionsRowOpen[i]=!subscriptionsRowOpen[i];">
<div class="arrow-right" *ngIf="!subscriptionsRowOpen[i]"></div>
<div class="arrow-down" *ngIf="subscriptionsRowOpen[i]"></div>
</div>
{{p.product_id}}
</td>
<td>{{p.original_transaction_id}}</td>
<td>{{getStoreText(p.store)}}</td>
<td>{{p.purchase_time}}</td>
<td>{{p.expiry_time}}</td>
<td>{{p.create_time}}</td>
<td>{{p.refund_time}}</td>
</tr>
<tr *ngIf="subscriptionsRowOpen[i]" class="open-row">
<td colspan="7">
<div class="p-2">
<div><small><b>Provider Response</b></small></div>
<div>
<pre class="pre-wrap m-0 p-0"><small>{{p.provider_response}}</small></pre>
</div>
<div class="pt-2"><small><b>Provider Notification</b></small></div>
<div>
<pre class="pre-wrap m-0 p-0"><small>{{p.provider_notification}}</small></pre>
</div>
</div>
</tr>
</ng-template>
<tr *ngIf="subscriptions.length === 0"><td colspan="6" class="text-muted">No purchases were found.</td></tr>
<tr *ngIf="subscriptions.length === 0"><td colspan="7" class="text-muted">No subscriptions were found.</td></tr>
</tbody>
</table>
</div>
Expand Up @@ -29,6 +29,7 @@ import {Observable} from 'rxjs';
})
export class SubscriptionsComponent implements OnInit {
public subscriptions: ApiValidatedSubscription[] = [];
public subscriptionsRowOpen: boolean[] = [];
public error = '';
public nextCursor = '';
public prevCursor = '';
Expand Down Expand Up @@ -58,6 +59,7 @@ export class SubscriptionsComponent implements OnInit {
cursor,
).subscribe(res => {
this.subscriptions = res.validated_subscriptions;
this.subscriptionsRowOpen = [];
this.nextCursor = res.cursor;
this.prevCursor = res.prev_cursor;
}, error => {
Expand Down

0 comments on commit 989f52b

Please sign in to comment.