mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55:44 +01:00
added logout method
This commit is contained in:
@@ -48,6 +48,19 @@ public class BasicSecurityContext implements SecurityContext
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@Override
|
||||
public void logout(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
user = null;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,6 +38,15 @@ public interface SecurityContext
|
||||
HttpServletResponse response, String username,
|
||||
String password);
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
public void logout(HttpServletRequest request, HttpServletResponse response);
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,6 +43,27 @@ import javax.ws.rs.core.Response;
|
||||
public class AuthenticationResource
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("logout")
|
||||
public Response logout(@Context HttpServletRequest request,
|
||||
@Context HttpServletResponse response)
|
||||
{
|
||||
securityContext.logout(request, response);
|
||||
|
||||
return Response.ok().build();
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -55,6 +76,7 @@ public class AuthenticationResource
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("login")
|
||||
public ScmState getState(@Context HttpServletRequest request,
|
||||
@Context HttpServletResponse response,
|
||||
@FormParam("username") String username,
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
<script type="text/javascript" src="resources/js/layout.js"></script>
|
||||
<script type="text/javascript" src="plugins/sonia.plugin.js"></script>
|
||||
|
||||
<!--
|
||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
|
||||
-->
|
||||
<title>SCM-WebAPP</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -76,6 +76,22 @@ Ext.onReady(function(){
|
||||
addTabPanel('t_config', 'configPanel', 'Repository Config');
|
||||
}
|
||||
|
||||
function logout(){
|
||||
Ext.Ajax.request({
|
||||
url: restUrl + 'authentication/logout.json',
|
||||
method: 'GET',
|
||||
success: function(response){
|
||||
tabPanel.removeAll();
|
||||
Ext.getCmp('west').removeAll();
|
||||
var loginWin = new Sonia.login.Window();
|
||||
loginWin.show();
|
||||
},
|
||||
failure: function(){
|
||||
alert("logout failed");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createMainMenu(){
|
||||
var panel = Ext.getCmp('west');
|
||||
panel.addSections([{
|
||||
@@ -96,6 +112,12 @@ Ext.onReady(function(){
|
||||
label: 'Server',
|
||||
fn: function(){ console.debug( 'Server Config' ); }
|
||||
}]
|
||||
},{
|
||||
title: 'Abmelden',
|
||||
items: [{
|
||||
label: 'Abmelden',
|
||||
fn: logout
|
||||
}]
|
||||
}]);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{
|
||||
|
||||
var config = {
|
||||
labelWidth: 80,
|
||||
url: restUrl + "authentication.json",
|
||||
url: restUrl + "authentication/login.json",
|
||||
frame: true,
|
||||
title: 'Please Login',
|
||||
defaultType: 'textfield',
|
||||
|
||||
Reference in New Issue
Block a user