{% extends theme('base.html') %}
{% import 'fomanticui.html' as sui %}

{% block content %}
    <div class="loginform">
        <h3 class="ui top attached header">
            {% trans %}View a token{% endtrans %}
        </h3>

        <div class="ui attached clearing segment">
            <table class="ui celled striped table">
                <tr>
                    <td>{{ _("Issue date") }}</td>
                    <td>{{ token.issue_date }}</td>
                </tr>
                <tr>
                    <td>{{ _("Client") }}</td>
                    <td>
                        <a href="{{ url_for("oidc.clients.edit", client_id=token_client.client_id) }}">
                            {{ token_client.client_name }}
                        </a>
                    </td>
                </tr>
                <tr>
                    <td>{{ _("Subject") }}</td>
                    <td>
                        <a href="{{ url_for("account.profile_edition", username=token_user.uid[0]) }}">
                            {{ token_user.name }} - {{ token_user.uid[0] }}
                        </a>
                    </td>
                </tr>
                <tr>
                    <td>{{ _("Scope") }}</td>
                    <td>
                        <ul class="ui list">
                            {% for scope in token.scope %}
                                <li class="item">{{ scope }}</li>
                            {% endfor %}
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td>{{ _("Audience") }}</td>
                    <td>
                        <ul class="ui list">
                            {% for client in token_audience %}
                                <li class="item">
                                    <a href="{{ url_for("oidc.clients.edit", client_id=client.dn) }}">
                                        {{ client.client_name }}
                                    </a>
                                </li>
                            {% endfor %}
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td>{{ _("Revokation date") }}</td>
                    <td>{% if token.revokation_date %}{{ token.revokation_date }}{% endif %}</td>
                </tr>
                <tr>
                    <td>{{ _("Lifetime") }}</td>
                    <td>{{ token.lifetime }}</td>
                </tr>
                <tr>
                    <td>{{ _("Token type") }}</td>
                    <td>{{ token.type }}</td>
                </tr>
                <tr>
                    <td>{{ _("Access token") }}</td>
                    <td><pre>{{ token.access_token }}</pre></td>
                </tr>

                <tr>
                    <td>{{ _("Refresh token") }}</td>
                    <td><pre>{{ token.refresh_token }}</pre></td>
                </tr>
            </table>
        </div>
    </div>
{% endblock %}
