与之相反:如何使用spring security手动注销用户?
在我的应用程序中,我已经注册了新用户屏幕,该屏幕发布到控制器,该控制器在db中创建新用户(并进行一些明显的检查).然后我希望这个新用户自动登录...我有点想要一些东西像这样 :
SecurityContextHolder.getContext().setPrincipal(MyNewUser);
Run Code Online (Sandbox Code Playgroud)
编辑 好我几乎已经基于如何以Spring Security 3.1以编程方式登录用户的答案实现
Authentication auth = new UsernamePasswordAuthenticationToken(MyNewUser, null);
SecurityContextHolder.getContext().setPrincipal(MyNewUser);
Run Code Online (Sandbox Code Playgroud)
但是,在部署时,jsp无法访问我,MyNewUser.getWhateverMethods()而在正常登录过程之后也是如此.这个代码在名义上有效,但在登录时会抛出错误如下:
<sec:authentication property="principal.firstname" />
Run Code Online (Sandbox Code Playgroud) 我目前正在尝试加载Flickr Photo的UITableView列表(cs193p iOS Stanford,作业5).为了避免UI阻塞事件,我将每个单元的缩略图下载推迟到不同的队列(但是在主队列中更新UI).此代码不会异步加载图像,但是一旦我单击UITableViewCell行,就会添加缩略图.(见下面的截图).知道我做错了什么吗?
PS:我已经看过其他一些stackoverflow问题和Apple的LazyTableImages示例,但我仍然相信这是达到预期结果的最简洁方法.
谢谢!
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Photo List Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell
NSDictionary *photo = [self.photoList objectAtIndex:indexPath.row];
if (photo != nil) {
if ([[photo objectForKey:@"title"] length] > 0) {
cell.textLabel.text = [photo objectForKey:@"title"];
} else if ([[[photo objectForKey:@"description"] objectForKey:@"_content"] length] > 0) {
cell.textLabel.text = [[photo objectForKey:@"description"] objectForKey:@"_content"];
} else {
cell.textLabel.text = @"Unknown";
}
}
cell.imageView.image = [[UIImage alloc] initWithCIImage:nil];
// Fetch …Run Code Online (Sandbox Code Playgroud) 我正在使用Jenkins进行CI,
我听说我应该有一个专门的服务器和奴隶来分别运行Jenkins和构建任务 -
这是真的吗?
我可以理解这一点,因为服务器可能不够强大,无法处理服务器本身和运行构建任务,
但是有没有明确的技术原因呢?