summaryrefslogtreecommitdiffstats
path: root/templates/index.html
blob: fa6c1650d62561728cc488504ece5b95a8d88c4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{% extends "admin/base.html" %}
{% block content %}
<div class="jumbotron">
    <div class="container">
        <h1>
            OIDC Identity Provider Configuration
        </h1>
    </div>
</div>

<div class="container">
    <div class="row pb-4">
        <div class="col-md-12">
            <ul class="nav nav-tabs nav-fill" role="tablist">
                <li class="nav-item">
                    <a class="nav-link active" data-toggle="tab" href="#setup" role="tab">
                        Setup
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" data-toggle="tab" href="#clients" role="tab">
                        Clients
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" data-toggle="tab" href="#keys" role="tab">
                        Signing Keys
                    </a>
                </li>
            </ul>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12 table-responsive">
            <div class="tab-content">
                <div class="tab-pane fade show active" id="setup" role="tabpanel">
                    <form method="POST" action="{{ url_for('oidc_admin.config') }}">
                        <input id="nonce" name='nonce' type='hidden' value="{{ Session.nonce }}">

                        <div class="form-group">
                            <b><label>Base URL</label></b>
                            <input name="base_url" class="form-control" value="{{ baseUrl }}" required>
                            <small class="form-text text-muted">
                                Set this to the URL that this CTFd instance is accessible at (including the protocol).
                                This is required for OIDC discovery to work properly.
                            </small>
                        </div>

                        <button class="btn btn-primary mt-3">Save</button>
                    </form>
                </div>
                <div class="tab-pane fade" id="clients" role="tabpanel">
                    <table class="table pb-8">
                    <tr>
                        <th>Client ID</th>
                        <th>Client secret</th>
                        <th>Redirect URIs</th>
                        <th></th>
                    </tr>
                    {% for c in clients %}
                    <tr>
                        <td>{{ c.client_id }}</td>
                        <td>{{ c.client_secret }}</td>
                        <td><small>{{ c.redirect_uris }}</small></td>
                        <td>
                        <form method="POST" action="{{ url_for('oidc_admin.delete_client', client_id=c.client_id) }}">
                            <input id="nonce" name='nonce' type='hidden' value="{{ Session.nonce }}">

                            <button class="btn btn-danger btn-sm">Delete</button>
                        </form>
                        </td>
                    </tr>
                    {% endfor %}
                    </table>

                    <h2>Create new client</h2>

                    <form method="POST" action="{{ url_for('oidc_admin.clients' )}}">
                        <input id="nonce" name='nonce' type='hidden' value="{{ Session.nonce }}">

                        <div class="form-group">
                            <b><label>Client ID</label></b>
                            <input name="client_id" class="form-control" required>
                        </div>

                        <div class="form-group">
                            <b><label>Redirect URIs (one per line)</label></b>
                            <textarea name="redirect_uris" class="form-control" required></textarea>
                        </div>

                        <button class="btn btn-primary mt-3">Create</button>
                    </form>
                </div>
                <div class="tab-pane fade" id="keys" role="tabpanel">
                    <table class="table pb-4">
                    <tr>
                        <th>KID</th>
                        <th>Created</th>
                    </tr>
                    {% for k in keys %}
                    <tr>
                        <td>{{ k.kid }}</td>
                        <td>{{ k.created }}</td>
                    </tr>
                    {% endfor %}
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}