principal

SecurityContextHolder gives wrong User details

点点圈 提交于 2020-12-01 07:21:08
问题 In my Application, We are capturing User details of each transaction from SecurityContextHolder Authentication object. But it gives wrong UserID it seems. Below are the code snippet for your reference. SecurityContext.xml spring-security-3.2 -- <security:http auto-config="true"> <!-- Restrict URLs based on role --> <security:headers> <security:cache-control/> <security:content-type-options/> <security:frame-options policy="DENY"/> <security:xss-protection/> </security:headers> <security

Web前端实战案例

扶醉桌前 提交于 2020-02-02 06:40:56
制作404页面 < ! DOCTYPE html > < html lang = "en" > < head > < meta charset = "UTF-8" > < title > 登录和注册页面设计 < / title > < style > /*通配选择器*/ * { margin : 0 ; padding : 0 ; } . box { font - family : "Microsoft YaHei UI" ; font - size : 80 px ; color : #f1ebe5 ; /*字体阴影*/ text - shadow : 0 8 px 9 px #c4b59d , 0 px - 2 px 1 px rgba ( 255 , 46 , 108 , 0.73 ) ; /*设置字体加粗*/ font - weight : bold ; text - align : center ; padding : 20 px 100 px ; /*设置颜色渐变*/ background : linear - gradient ( to bottom , # 0 dc418 0 % , # 5 dc4a3 100 % ) ; } h1 { border - bottom : 1 px solid #fff ; } h2 { font - size : 20 px ;

Retaining principal inside queued background work item

大城市里の小女人 提交于 2019-12-23 07:36:18
问题 I'm using ASP.Net Web API 2 / .Net 4.5.2. I'm trying to retain the calling principal when queueing a background work item. To that end, I'm trying to: Thread.CurrentPrincipal = callingPrincipal; But when I do so, I get an ObjectDisposedException: System.ObjectDisposedException: Safe handle has been closed How do I keep the current principal inside the background work item? Can I make a copy of the principal somehow? public void Run<T>(Action<T> action) { _logger.Debug("Queueing background

Spring websockets without principal

╄→尐↘猪︶ㄣ 提交于 2019-12-21 21:45:45
问题 I am trying to implement a simple websockets application that can send messages from one endpoint to a specified session established elsewhere. So far I have been able to use the annotation @SendToUser() in order for a client to subscribe to a channel (as discussed in this question: Spring Websockets @SendToUser without login?) However, I now want to create a separate endpoint that, when called, looks up a user associated with data passed into this endpoint and sends a message to that user

How should I check if a user is authenticated in MVC5?

℡╲_俬逩灬. 提交于 2019-12-20 08:33:19
问题 I have seen the following two accessible booleans: System.Web.Mvc.Controller.User.Identity.IsAuthenticated System.Web.Mvc.Controller.Request.IsAuthenticated Is there a difference between these. They both seem to do the same thing so I am not sure which to use. What I would like to do is: @if (User.Identity.IsAuthenticated) { if (User.IsInRole("Admin")) { @Html.ActionLink("Admin", "AdminController") } } or @if (Request.IsAuthenticated) { if (User.IsInRole("Admin")) { @Html.ActionLink("Admin",

How do I get the Current User identity for a VPN user in a Windows forms app?

南笙酒味 提交于 2019-12-17 16:49:08
问题 We're currently developing a Windows Smartclient that needs to authenticate users using their AD group membership. We now have a requirement for some users to connect over VPN. Is there any way I can get the AD account identity and groups from the VPN login? WindowsIdentity.GetCurrent() returns the local user account rather than their VPN account information. The local account name is different that the AD account used for the VPN connection. i.e the user is on their home PC, and connecting

How do I start a thread in a different security context?

强颜欢笑 提交于 2019-12-17 10:54:30
问题 How to start a thread in the security context of a different user? When a process starts a thread normally the security context is also passed but how to launch a thread in a different security context with the principal of a different user? 回答1: I believe that you can just set the CurrentPrincipal as first operation of the thread code after the thread has started, and only then begin to execute the code which is supposed to run with the other principal. This should take care of any .NET role

Why does my FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal() code runs to NullPointer?

大憨熊 提交于 2019-12-11 03:33:39
问题 I have a stateless bean which has a method, where I want to get the current/logged user. My code to get it: Principal p1 = FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal(); But I am getting nullpointer exception on this. Why is that? Or is there any other way to get the logged user? I am using weblogic. 回答1: You're not supposed to grab the FacesContext in an EJB. Even more, your EJBs should be completely free from any JSF dependencies. In other words, you should not

How I get Active Directory User Properties with System.DirectoryServices.AccountManagement Namespace?

时光怂恿深爱的人放手 提交于 2019-12-09 17:07:34
问题 I want do get Active Directory Properties from a user and I want to use System.DirectoryServices.AccountManagement . my code: public static void GetUserProperties(string dc,string user) { PrincipalContext ctx = new PrincipalContext(ContextType.Domain, dc); UserPrincipal u = UserPrincipal.FindByIdentity(ctx, user); string firstname = u.GivenName; string lastname = u.Surname; string email = u.EmailAddress; string telephone = u.VoiceTelephoneNumber; ...//how I can get company and other

App Domain Level Impersonation

空扰寡人 提交于 2019-12-08 19:06:05
问题 I am developing an application that needs to load plug-ins into separate child app domains. Only one plug-in is loaded into one child app domain. Each plug-in requires different Windows identity and those identities are different from the Windows identity used in default (parent) app domain. Each plug-in loads one or more of its child plug-ins. E.g. Identity of default app domain is Authority\Limited (Authority is either domain name or machine name). Two plug-ins are loaded into two child app