require redirect
This commit is contained in:
parent
3be4579204
commit
11c23a7945
6 changed files with 35 additions and 13 deletions
|
@ -14,6 +14,7 @@ public class UserSessionRepresentation {
|
||||||
private String user;
|
private String user;
|
||||||
private String ipAddress;
|
private String ipAddress;
|
||||||
private long start;
|
private long start;
|
||||||
|
private long lastAccess;
|
||||||
private Set<String> applications = new HashSet<String>();
|
private Set<String> applications = new HashSet<String>();
|
||||||
private Map<String, String> clients = new HashMap<String, String>();
|
private Map<String, String> clients = new HashMap<String, String>();
|
||||||
|
|
||||||
|
@ -49,6 +50,14 @@ public class UserSessionRepresentation {
|
||||||
this.start = start;
|
this.start = start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getLastAccess() {
|
||||||
|
return lastAccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastAccess(long lastAccess) {
|
||||||
|
this.lastAccess = lastAccess;
|
||||||
|
}
|
||||||
|
|
||||||
public Set<String> getApplications() {
|
public Set<String> getApplications() {
|
||||||
return applications;
|
return applications;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,10 @@ public class SessionsBean {
|
||||||
return Time.toDate(session.getStarted());
|
return Time.toDate(session.getStarted());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Date getLastAccess() {
|
||||||
|
return Time.toDate(session.getLastSessionRefresh());
|
||||||
|
}
|
||||||
|
|
||||||
public Date getExpires() {
|
public Date getExpires() {
|
||||||
int max = session.getStarted() + realm.getSsoSessionMaxLifespan();
|
int max = session.getStarted() + realm.getSsoSessionMaxLifespan();
|
||||||
return Time.toDate(max);
|
return Time.toDate(max);
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>IP</td>
|
<td>IP</td>
|
||||||
<td>Started</td>
|
<td>Started</td>
|
||||||
|
<td>Last Access</td>
|
||||||
<td>Expires</td>
|
<td>Expires</td>
|
||||||
<td>Applications</td>
|
<td>Applications</td>
|
||||||
<td>Clients</td>
|
<td>Clients</td>
|
||||||
|
@ -23,6 +24,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>${session.ipAddress}</td>
|
<td>${session.ipAddress}</td>
|
||||||
<td>${session.started?datetime}</td>
|
<td>${session.started?datetime}</td>
|
||||||
|
<td>${session.lastAccess?datetime}</td>
|
||||||
<td>${session.expires?datetime}</td>
|
<td>${session.expires?datetime}</td>
|
||||||
<td>
|
<td>
|
||||||
<ul style="list-style: none; ">
|
<ul style="list-style: none; ">
|
||||||
|
|
|
@ -264,16 +264,20 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
|
||||||
|
|
||||||
$scope.save = function() {
|
$scope.save = function() {
|
||||||
if ($scope.create) {
|
if ($scope.create) {
|
||||||
Application.save({
|
if (!$scope.application.redirectUris || $scope.application.redirectUris.length == 0) {
|
||||||
realm: realm.realm,
|
Notifications.error("You must specify at least one redirect uri");
|
||||||
application: ''
|
} else {
|
||||||
}, $scope.application, function (data, headers) {
|
Application.save({
|
||||||
$scope.changed = false;
|
realm: realm.realm,
|
||||||
var l = headers().location;
|
application: ''
|
||||||
var id = l.substring(l.lastIndexOf("/") + 1);
|
}, $scope.application, function (data, headers) {
|
||||||
$location.url("/realms/" + realm.realm + "/applications/" + id);
|
$scope.changed = false;
|
||||||
Notifications.success("The application has been created.");
|
var l = headers().location;
|
||||||
});
|
var id = l.substring(l.lastIndexOf("/") + 1);
|
||||||
|
$location.url("/realms/" + realm.realm + "/applications/" + id);
|
||||||
|
Notifications.success("The application has been created.");
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Application.update({
|
Application.update({
|
||||||
realm : realm.realm,
|
realm : realm.realm,
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<table class="table table-striped table-bordered">
|
<table class="table table-striped table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="kc-table-actions" colspan="5">
|
<th class="kc-table-actions" colspan="6">
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<a class="btn btn-primary" ng-click="logoutAll()">Logout All Sessions</a>
|
<a class="btn btn-primary" ng-click="logoutAll()">Logout All Sessions</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -26,7 +26,8 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>IP Address</th>
|
<th>IP Address</th>
|
||||||
<th>Login Time</th>
|
<th>Started</th>
|
||||||
|
<th>Last Access</th>
|
||||||
<th>Applications</th>
|
<th>Applications</th>
|
||||||
<th>OAuth Clients</th>
|
<th>OAuth Clients</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
|
@ -36,6 +37,7 @@
|
||||||
<tr data-ng-repeat="session in sessions">
|
<tr data-ng-repeat="session in sessions">
|
||||||
<td>{{session.ipAddress}}</td>
|
<td>{{session.ipAddress}}</td>
|
||||||
<td>{{session.start | date:'medium'}}</td>
|
<td>{{session.start | date:'medium'}}</td>
|
||||||
|
<td>{{session.lastAccess | date:'medium'}}</td>
|
||||||
<td><ul style="list-style: none; ">
|
<td><ul style="list-style: none; ">
|
||||||
<li data-ng-repeat="app in session.applications">
|
<li data-ng-repeat="app in session.applications">
|
||||||
<a href="#/realms/{{realm.realm}}/applications/{{app}}/sessions">{{app}}</a>
|
<a href="#/realms/{{realm.realm}}/applications/{{app}}/sessions">{{app}}</a>
|
||||||
|
|
|
@ -186,7 +186,8 @@ public class ModelToRepresentation {
|
||||||
public static UserSessionRepresentation toRepresentation(UserSessionModel session) {
|
public static UserSessionRepresentation toRepresentation(UserSessionModel session) {
|
||||||
UserSessionRepresentation rep = new UserSessionRepresentation();
|
UserSessionRepresentation rep = new UserSessionRepresentation();
|
||||||
rep.setId(session.getId());
|
rep.setId(session.getId());
|
||||||
rep.setStart(((long)session.getStarted()) * 1000);
|
rep.setStart(((long)session.getStarted()) * 1000L);
|
||||||
|
rep.setLastAccess(((long)session.getLastSessionRefresh())* 1000L);
|
||||||
rep.setUser(session.getUser().getLoginName());
|
rep.setUser(session.getUser().getLoginName());
|
||||||
rep.setIpAddress(session.getIpAddress());
|
rep.setIpAddress(session.getIpAddress());
|
||||||
for (ClientModel client : session.getClientAssociations()) {
|
for (ClientModel client : session.getClientAssociations()) {
|
||||||
|
|
Loading…
Reference in a new issue