Propage 2F devices display to session module (#1391)

This commit is contained in:
Christophe Maudoux 2018-04-19 16:28:49 +02:00
parent abd25790fc
commit 2b1d6d4819
5 changed files with 92 additions and 26 deletions

View File

@ -216,8 +216,7 @@ llapp.controller 'SessionsExplorerCtrl', ['$scope', '$translator', '$location',
subres.push
title: attr
value: session[attr]
delete session[attr]
delete session[attr]
if subres.length >0
res.push
title: "__#{category}__"

View File

@ -77,13 +77,14 @@ hiddenAttributes = '_password'
categories =
dateTitle: ['_utime', '_startTime', '_updateTime', '_lastAuthnUTime', '_lastSeen']
connectionTitle: ['ipAddr', '_timezone', '_url']
authenticationTitle:['_session_id', '_user', '_password', 'authenticationLevel', '_2fDevices']
authenticationTitle:['_session_id', '_user', '_password', 'authenticationLevel']
modulesTitle: ['_auth', '_userDB', '_passwordDB', '_issuerDB', '_authChoice', '_authMulti', '_userDBMulti']
saml: ['_idp', '_idpConfKey', '_samlToken', '_lassoSessionDump', '_lassoIdentityDump']
groups: ['groups', 'hGroups']
ldap: ['dn']
BrowserID: ['_browserIdAnswer', '_browserIdAnswerRaw']
OpenIDConnect: ['_oidc_id_token', '_oidc_OP', '_oidc_access_token']
sfaTitle: ['_2fDevices']
# Menu entries
menu =
@ -203,11 +204,33 @@ llapp.controller 'SessionsExplorerCtrl', ['$scope', '$translator', '$location',
for category, attrs of categories
subres = []
for attr in attrs
if session[attr]
subres.push
title: attr
value: session[attr]
delete session[attr]
if session[attr] and session[attr].match(/\w+/)
if session[attr].match(/"type":\s*"(?:TOTP|U2F|UBK)"/)
subres.push
title: "type"
value: "name"
epoch: "date"
array = JSON.parse(session[attr]);
for sfDevice in array
for key, value of sfDevice
if key == 'type'
title = value
if key == 'name'
name = value
if key == 'epoch'
epoch = value
subres.push
title: title
value: name
epoch: epoch
delete session[attr]
else
subres.push
title: attr
value: session[attr]
epoch: ''
delete session[attr]
if subres.length >0
res.push
title: "__#{category}__"

View File

@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.9.3
// Generated by CoffeeScript 1.10.0
/*
* Session explorer
@ -94,13 +94,14 @@
categories = {
dateTitle: ['_utime', '_startTime', '_updateTime', '_lastAuthnUTime', '_lastSeen'],
connectionTitle: ['ipAddr', '_timezone', '_url'],
authenticationTitle: ['_session_id', '_user', '_password', 'authenticationLevel', '_2fDevices'],
authenticationTitle: ['_session_id', '_user', '_password', 'authenticationLevel'],
modulesTitle: ['_auth', '_userDB', '_passwordDB', '_issuerDB', '_authChoice', '_authMulti', '_userDBMulti'],
saml: ['_idp', '_idpConfKey', '_samlToken', '_lassoSessionDump', '_lassoIdentityDump'],
groups: ['groups', 'hGroups'],
ldap: ['dn'],
BrowserID: ['_browserIdAnswer', '_browserIdAnswerRaw'],
OpenIDConnect: ['_oidc_id_token', '_oidc_OP', '_oidc_access_token']
OpenIDConnect: ['_oidc_id_token', '_oidc_OP', '_oidc_access_token'],
sfaTitle: ['_2fDevices']
};
menu = {
@ -185,7 +186,7 @@
$scope.displaySession = function(scope) {
var sessionId, transformSession;
transformSession = function(session) {
var _insert, _stToStr, attr, attrs, category, i, id, j, k, key, l, len, len1, len2, ref, ref1, res, subres, time, tmp, value;
var _insert, _stToStr, array, attr, attrs, category, epoch, i, id, j, k, key, l, len, len1, len2, len3, m, name, ref, ref1, res, sfDevice, subres, time, title, tmp, value;
_stToStr = function(s) {
return s;
};
@ -237,12 +238,43 @@
subres = [];
for (i = 0, len = attrs.length; i < len; i++) {
attr = attrs[i];
if (session[attr]) {
subres.push({
title: attr,
value: session[attr]
});
delete session[attr];
if (session[attr] && session[attr].match(/\w+/)) {
if (session[attr].match(/"type":\s*"(?:TOTP|U2F|UBK)"/)) {
subres.push({
title: "type",
value: "name",
epoch: "date"
});
array = JSON.parse(session[attr]);
for (j = 0, len1 = array.length; j < len1; j++) {
sfDevice = array[j];
for (key in sfDevice) {
value = sfDevice[key];
if (key === 'type') {
title = value;
}
if (key === 'name') {
name = value;
}
if (key === 'epoch') {
epoch = value;
}
}
subres.push({
title: title,
value: name,
epoch: epoch
});
}
delete session[attr];
} else {
subres.push({
title: attr,
value: session[attr],
epoch: ''
});
delete session[attr];
}
}
}
if (subres.length > 0) {
@ -258,8 +290,8 @@
tmp = [];
if (session._loginHistory.successLogin) {
ref = session._loginHistory.successLogin;
for (j = 0, len1 = ref.length; j < len1; j++) {
l = ref[j];
for (k = 0, len2 = ref.length; k < len2; k++) {
l = ref[k];
tmp.push({
t: l._utime,
title: $scope.localeDate(l._utime),
@ -269,8 +301,8 @@
}
if (session._loginHistory.failedLogin) {
ref1 = session._loginHistory.failedLogin;
for (k = 0, len2 = ref1.length; k < len2; k++) {
l = ref1[k];
for (m = 0, len3 = ref1.length; m < len3; m++) {
l = ref1[m];
tmp.push({
t: l._utime,
title: $scope.localeDate(l._utime),

File diff suppressed because one or more lines are too long

View File

@ -91,9 +91,21 @@
</table>
</div>
<div ng-if="!node.nodes">
<th>{{translate(node.title)}}</th>
<td><tt>${{node.title}}</tt></td>
<td><span id="v-{{node.title}}">{{node.value}}</td>
<th ng-if="node.title!='UBK' && node.title!='TOTP' && node.title!='U2F'">{{translate(node.title)}}</th>
<td ng-if="node.title!='type' && node.title!='UBK' && node.title!='TOTP' && node.title!='U2F' " >${{node.title}}</td>
<td ng-if="node.title=='TOTP' || node.title=='UBK' || node.title=='U2F'">{{node.title}}</td>
<th ng-if="node.title=='type'">{{translate(node.value)}}</th>
<td ng-if="node.title!='type'" >{{node.value}}</td>
<th ng-if="node.title=='type'">{{translate(node.epoch)}}</th>
<td ng-if="node.title=='TOTP' || node.title=='UBK' || node.title=='U2F'">{{localeDate(node.epoch)}}</td>
<td></td>
</div>
</script>