Adding Capif invoker
[nonrtric/plt/sme.git] / invoker / view / gettoken.html
1 <!--
2    ========================LICENSE_START=================================
3    O-RAN-SC
4    %%
5    Copyright (C) 2023: Nordix Foundation
6    %%
7    Licensed under the Apache License, Version 2.0 (the "License");
8    you may not use this file except in compliance with the License.
9    You may obtain a copy of the License at
10
11         http://www.apache.org/licenses/LICENSE-2.0
12
13    Unless required by applicable law or agreed to in writing, software
14    distributed under the License is distributed on an "AS IS" BASIS,
15    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16    See the License for the specific language governing permissions and
17    limitations under the License.
18    ========================LICENSE_END===================================
19 -->
20 {{define "title"}}
21   CAPIF Invoker
22 {{end}}
23
24 {{define "body"}}
25   {{if .isResponse}}
26   <div class="p-5 mb-4 bg-light rounded-3">
27     <div class="container-fluid py-5">
28       <h4 class="card-subtitle mb-3 text-body-secondary">Response from CAPIF core</h4>
29       <div class="callout callout-info">
30         <h5 class="card-subtitle mb-3 text-body-secondary">Access Token Response</h5>
31         <div id="response" class="text-truncate">
32           <h6>
33             Access token:
34             <small id="accessToken" class="text-muted"></small>
35           </h6>
36           <h6>
37             Expires in:
38             <small id="expiresIn" class="text-muted"></small>
39           </h6>
40           <h6>
41             Scope:
42             <small id="scope" class="text-muted"></small>
43           </h6>
44           <h6>
45             Token type:
46             <small id="tokenType" class="text-muted"></small>
47           </h6>
48         </div>
49       </div>
50
51       <div class="btns col-md-12 text-center">
52         <form action="/" method="GET">
53             <input class="btn btn-secondary" formaction="/" type="submit" value="Return to main page">
54           </form>
55       </div>
56     </div>
57   </div>
58   <script>
59     var htmlResponse = "{{.response}}"
60     const strData = JSON.parse(htmlResponse);
61     document.getElementById("accessToken").innerHTML = strData.access_token;
62     document.getElementById("expiresIn").innerHTML = strData.expires_in;
63     document.getElementById("scope").innerHTML = strData.scope;
64     document.getElementById("tokenType").innerHTML = strData.token_type;
65   </script>
66   {{- else}}
67   <div class="p-5 mb-4 bg-light rounded-3">
68     <div class="container-fluid py-5">
69         {{if .isError}}
70             <div class="alert alert-danger" role="alert">
71                 {{.response}}
72             </div>
73         {{end}}
74       <h5 class="card-subtitle mb-3 text-body-secondary">CAPIF_Security_API > Obtain_Authorization</h5>
75       <form action="/gettoken" method="POST">
76         <div class="mb-3">
77           <label for="securityId" class="form-label">Security Id:</label>
78           <input type="text" class="form-control" id="securityId" name="securityId" placeholder="securityId" required>
79         </div>
80         <div class="mb-3">
81             <label for="clientId" class="form-label">Client Id:</label>
82             <input type="text" class="form-control" id="clientId" name="clientId" placeholder="clientId" required>
83         </div>
84         <div class="mb-3">
85             <label for="clientSecret" class="form-label">Client Secret:</label>
86             <input type="text" class="form-control" id="clientSecret" name="clientSecret" placeholder="clientSecret" >
87         </div>
88         <div class="mb-3">
89             <label for="scope" class="form-label">Scope:</label>
90             <input type="text" class="form-control" id="scope" name="scope" placeholder="scope" >
91         </div>
92         <div class="btns col-md-12 text-center">
93             <input class="btn btn-primary" type="submit" value="Submit">
94             <input class="btn btn-secondary" formaction="/" type="submit" value="Cancel" formnovalidate>
95         </div>
96       </form>
97     </div>
98   </div>
99   {{- end}}
100 {{end}}
101
102