security-context

Determining the current security checks being made (SQL Server)

白昼怎懂夜的黑 提交于 2021-02-09 01:57:25
问题 One thing that I've always hated more than just about anything in MS SQL Server is the way that security works. The security context constantly switches if you look at the server funny and it's often very hard (for me anyway) to predict or debug. In dealing with an issue today, I though, "I wish I could just add a line to my code that would display the security context that SQL Server is using when this code runs." Does such a command exist? For example, SELECT security_context() To be a

SecurityContext with default System authentication/user

为君一笑 提交于 2020-04-06 03:05:10
问题 In my spring application, I would like that a SecurityContext always holds an Authentication . If it's not a regular UsernamePasswordAuthenticationToken , it will be a PreAuthenticatedAuthenticationToken describing the "system user." This has reasons within different system function which requires a user. To avoid a special treatment if there is no user context, I merely want to add the system context. IMHO, this has also to do with the single responsibility principle. To achieve this, I can

Symfony2 : Why getToken return null when injecting SecurityContext in a TwigExtension?

孤街浪徒 提交于 2020-02-24 00:50:35
问题 I did exactly the answer from this post but the token property is null and the user is correctly logged in and the route is behind a firewall. Also, I am injecting the SecurityContext in other services and it works fine. services.xml : <service id="tc.extensions.relation_helper" class="TC\CoreBundle\Extensions\RelationHelperExtension"> <argument type="service" id="security.context" /> <tag name="twig.extension" /> </service> My extension: class RelationHelperExtension extends Twig_Extension {

Symfony2 : Why getToken return null when injecting SecurityContext in a TwigExtension?

核能气质少年 提交于 2020-02-24 00:49:11
问题 I did exactly the answer from this post but the token property is null and the user is correctly logged in and the route is behind a firewall. Also, I am injecting the SecurityContext in other services and it works fine. services.xml : <service id="tc.extensions.relation_helper" class="TC\CoreBundle\Extensions\RelationHelperExtension"> <argument type="service" id="security.context" /> <tag name="twig.extension" /> </service> My extension: class RelationHelperExtension extends Twig_Extension {

I don't know what SecurityContextHolder strategy to use

戏子无情 提交于 2019-12-25 01:27:14
问题 I use such code for authentication: @PreAuthorize("isAnonymous()") @RequestMapping(value = "/login", method = RequestMethod.POST) public String doLogin(HttpServletRequest request) { try { Authentication req = new UsernamePasswordAuthenticationToken(request.getParameter("name"), request.getParameter("password")); Authentication result = authenticationManager.authenticate(req); SecurityContextHolder.getContext().setAuthentication(result); logger.debug("Success login"); logger.debug

Is a SecurityContext shared between requests when using Spring Security?

十年热恋 提交于 2019-12-22 05:11:58
问题 I'm seeing some strange behaviour when using stateless token-based authentication on a rest API written using Spring Boot. The client includes a JWT token with each request, and a custom filter I've written that extends GenericFilterBean adds an Authentication object based on the claims in the token to the security context using the following : SecurityContextHolder.getContext().setAuthentication(authentication); And clears the context after processing the request by doing :

How to customize the behaviour of SecurityContextPersistenceFilter?

跟風遠走 提交于 2019-12-22 03:49:30
问题 I developing a stateless REST API that makes use of token based authentication, where I'm manually adding an Authentication object to the security context by calling SecurityContextHolder.getContext().setAuthentication(authentication) from within a custom security filter. I've been experiencing problems with the context not being set correctly which I believe is due to this : Storing the SecurityContext between requests In an application which receives concurrent requests in a single session,

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

Wildfly, JAAS and SecurityContext

落花浮王杯 提交于 2019-12-13 07:17:18
问题 I'm still playin with Wildfly-9.0.1.Final and JAAS (see my previous question Wildfly and JAAS login module) in a web application that use a BASIC auth-method . While my custom login module works I got some problems about authorization. I use a RESTeasy RESTFul web service with annotation to test, here is the code: package it.bytebear.web.mongo; import it.bytebear.web.mongo.jaas.MongoModuleCallbackHandler; import it.bytebear.web.mongo.model.User; import java.security.Principal; import java

InitializeSecurityContext (Schannel) not changing BufferType

ぃ、小莉子 提交于 2019-12-08 11:58:56
问题 So i have following code: SecBuffer input_buffers[2]; SecBuffer output_buffers[2]; ULONG context_attributes; /* we need to try and perform the second (next) step of the init */ input_buffers[0].cbBuffer = tls_io_instance->received_byte_count; input_buffers[0].BufferType = SECBUFFER_TOKEN; input_buffers[0].pvBuffer = (void*)tls_io_instance->received_bytes; input_buffers[1].cbBuffer = 0; input_buffers[1].BufferType = SECBUFFER_EMPTY; input_buffers[1].pvBuffer = 0; SecBufferDesc input_buffers