<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
<div id="content-area" class="col-sm-9" role="main">
    <kc-navigation-application></kc-navigation-application>
    <div id="content">
        <ol class="breadcrumb" data-ng-hide="create">
            <li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li>
            <li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">{{application.name}}</a></li>
            <li class="active">Keys</li>
        </ol>
        <h2><span>{{application.name}}</span> Key Pair and Certificate <span tooltip-placement="right" tooltip="Application's key pair and certificate.  Used for more confidential interaction between application and auth server." class="fa fa-info-circle"></span></h2>
        <form class="form-horizontal" name="keyForm" novalidate kc-read-only="!access.manageRealm">
            <fieldset class="form-group col-sm-10" data-ng-hide="!keyInfo.privateKey">
                <legend collapsed><span class="text">Java Keystore Download</span>  <span tooltip-placement="right" tooltip="Client key pair, cert, and realm certificate will be stuffed into a Java keystore that you can use in your applications." class="fa fa-info-circle"></span></legend>
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="keyAlias">Key Alias</label>
                    <div class="col-sm-4">
                        <input class="form-control" type="text" id="keyAlias" name="keyAlias" data-ng-model="jks.keyAlias" autofocus required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="keyPassword">Key Password</label>
                    <div class="col-sm-4">
                        <input class="form-control" type="text" id="keyPassword" name="keyPassword" data-ng-model="jks.keyPassword" autofocus required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="realmAlias">Realm Certificate Alias</label>
                    <div class="col-sm-4">
                        <input class="form-control" type="text" id="realmAlias" name="realmAlias" data-ng-model="jks.realmAlias" autofocus required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="storePassword">Store Password</label>
                    <div class="col-sm-4">
                        <input class="form-control" type="text" id="storePassword" name="storePassword" data-ng-model="jks.storePassword" autofocus required>
                    </div>
               </div>
                <div class="form-group" data-ng-show="access.manageRealm">
                    <div class="pull-right">
                        <button class="btn btn-primary" type="submit" data-ng-click="downloadJKS()">Download</button>
                    </div>
                </div>
            </fieldset>
            <fieldset class="form-group col-sm-10">
                <legend><span class="text">Keys and Certificate</span>  <span tooltip-placement="right" tooltip="Keys and cert in PEM format." class="fa fa-info-circle"></span></legend>
                <div class="form-group" data-ng-hide="!keyInfo.privateKey">
                    <label class="col-sm-2 control-label" for="publicKey">Private key</label>

                    <div class="col-sm-10">
                        <textarea type="text" id="Private" name="publicKey" class="form-control" rows="5"
                                  kc-select-action="click" readonly>{{keyInfo.privateKey}}</textarea>
                    </div>
                </div>
                <div class="form-group" data-ng-hide="!keyInfo.privateKey">
                    <label class="col-sm-2 control-label" for="publicKey">Public key</label>

                    <div class="col-sm-10">
                        <textarea type="text" id="publicKey" name="publicKey" class="form-control" rows="5"
                                  kc-select-action="click" readonly>{{keyInfo.publicKey}}</textarea>
                    </div>
                </div>
                <div class="form-group" data-ng-hide="!keyInfo.privateKey">
                    <label class="col-sm-2 control-label" for="publicKey">Certificate</label>

                    <div class="col-sm-10">
                        <textarea type="text" id="certificate" name="certificate" class="form-control" rows="5"
                                  kc-select-action="click" readonly>{{keyInfo.certificate}}</textarea>
                    </div>
                </div>
                <div class="form-group" data-ng-show="access.manageRealm">
                    <div class="pull-right">
                        <button class="btn btn-primary" type="submit" data-ng-click="generate()">Generate new keys</button>
                    </div>
                </div>
            </fieldset>
        </form>
    </div>
</div>