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