Commit c1eb5816 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg

Add IDtoken decoded view

parent b866abdb
......@@ -4242,6 +4242,11 @@
"resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
"integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM="
},
"jwt-decode": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-2.2.0.tgz",
"integrity": "sha1-fYa9VmefWM5qhHBKZX3TkruoGnk="
},
"keycode": {
"version": "2.1.9",
"resolved": "https://registry.npmjs.org/keycode/-/keycode-2.1.9.tgz",
......
......@@ -5,7 +5,7 @@ import {Row, Col, Collapse, FormControl, FormGroup, ControlLabel, HelpBlock, Pan
import HostnameController from '../containers/HostnameController'
import ServerConfigController from '../containers/ServerConfigController'
import WhiteBox from './WhiteBox'
import jwtDecode from 'jwt-decode'
import moment from 'moment'
import 'moment/locale/nb';
......@@ -21,6 +21,16 @@ export function expiresText(expires) {
class Component extends PureComponent {
getIDTokenView(idtoken) {
let str = JSON.stringify(jwtDecode(idtoken), undefined, 4)
return (
<div>
<h4>ID Token decoded</h4>
<pre>{str}</pre>
</div>
)
}
render() {
console.error("Component", this.props)
......@@ -30,14 +40,21 @@ class Component extends PureComponent {
)
}
let idtokenView = null
let extxt = expiresText(this.props.token.expires)
if (this.props.token.id_token) {
idtokenView = this.getIDTokenView(this.props.token.id_token)
}
return (
<Panel header="Access Token" eventKey="1" collapsible={true} expanded={true}>
<p>This access token expires {extxt}</p>
<pre>{this.props.tokenstring}</pre>
{idtokenView}
</Panel>
)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment