Questions tagged [security-context]

104 questions
0
votes
1 answer

jakarta.ws.rs.core.SecurityContext throws exception when testing in Quarkus

Custom class that has jakarta core @Context SecurityContext throws following exception: Method threw 'java.lang.IllegalStateException' exception. Cannot evaluate…
0
votes
1 answer

Spring Boot "SecurityContextHolder.getContext().getAuthentication()" returns the wrong credentials

I'm building a Spring Boot webapp, and I've encountered a problem. Whenever I first log in with a user I'm still getting that user's credentials with the SecurityContextHolder.getContext().getAuthentication() method, even after logging out with the…
lapartman
  • 45
  • 1
  • 7
0
votes
0 answers

daemonset doesn't create any pod which need hostpath access with namesapce at enforce=baseline level

We are testing pod security where product namesapce level enforce=baseline, in that case fluent-bit pods were not starting, They are failing with below message. We are testing pod security where product namesapce level enforce=baseline, in that case…
0
votes
0 answers

Spring security getAuthentication() return null

I try to get User Id, but have exception -> java.lang.NullPointerException: No authorized user found. Have custom AuthUser: import lombok.Getter; import lombok.Setter; import org.springframework.lang.NonNull; import…
0
votes
0 answers

k8s security context and permissions on volume

I want to mount volume into my pod but i am getting permission error when i set runAsUser, runAsGroup and fsGroup. Steps: Create new directory /share/pod-1-db Create new user, group user-1-db => uid=1234 gid=1234 Set ownership chown -R…
anonf34
  • 313
  • 1
  • 3
  • 8
0
votes
1 answer

readOnlyRootFilesystem prevents my code from writing logs

I added in my deployment readOnlyRootFilesystem: true but running my code ends with the following error: OSError: [Errno30] Read-only file system: '/project/logs/dbt.log' But /project/logs/dbt.log is NOT a root path. Any idea why does it…
jrz
  • 1,213
  • 4
  • 20
  • 54
0
votes
0 answers

How to manually authenticate keycloack user when execute a scheduled job in springboot application

I have a REST API springboot application that uses keycloack as authentication. All work fine with authentication and autorization. Now I have to schedule some jobs that will have to use resource services. The execution of these services is bound by…
0
votes
1 answer

podSecurityContext not working as expected on init container

For the first time I am trying to set pod security context. I added the following to the pod spec: securityContext: fsGroup: 2000 runAsNonRoot: true And when the pod is trying to come up, the init container is stuck in state…
jrz
  • 1,213
  • 4
  • 20
  • 54
0
votes
0 answers

Using custom security context with annotations in beforeAll method for integration tests

In many of my integration tests, I have to create Entities with a custom security context. Then within tests I use another security context to check for example the access rights. So I created a new…
MehdiB
  • 870
  • 12
  • 34
0
votes
0 answers

Spring Security Authentication Not Persisting Between Controllers

I'm trying to manually set the authentication in order to implement a system of user permissions. My ultimate goal is to be able to use the @PreAuthorize() annotation to restrict certain methods. Below is my security configuration. @Order(1) …
0
votes
0 answers

Inject Authentication in SecurityContext for JUnit tests (Java+Spring)

I have a test method for serivice method. Service method has the next annotation: @PreAuthorize("verifyRole(T(java.util.Set).of(" + "'ROLE_HEAD_BANK', 'ROLE_OPERATOR_BANK_REPORTER', 'ROLE_AUTHORIZED_BANK_REPORTER'," + "…
0
votes
1 answer

Certificate signed procedure cannot access data on another database in same instance

The scenario is simply to run a stored procedure, sign it with a certificate, and run it as an unprivileged user to get data from another database. The other database happens to be in the same instance as the database containing this stored…
0
votes
0 answers

Vaadin: What is the Spring context of the Drop component?

I am using the 21 version of Vaadin. I have the following code, taken from an example from the Vaadin website and slightly (purely beauty) modified by me. The remaining files are unchanged. the codes are given below. Why do I get such a…
0
votes
0 answers

OpenShift is running all pods with the first UID from the range

I have OpenShift 4.7 installed, using the default restricted SCC. The UID range is: openshift.io/sa.scc.uid-range: 1000700000/10000 I have 3 replica pods of a Deploymwent, and all are getting the same UID: uid=1000700000(1000700000) gid=0(root)…
0
votes
1 answer

How to create pod with default uid:gid and multiple groups access gids( 4 to 5 ) that's needed to access nfs shares.?

I'm trying to containerize a workflow that touches nfs shares. For a successful run it requires user to have default uid:gid and also additional 4 or 5 groupid access. group ids are random and ideally i would like to avoid giving range of gid's in…