-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use token based authentication
- Loading branch information
Showing
10 changed files
with
57 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
server/src/test/java/mucsi96/traininglog/WithMockUserRoles.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package mucsi96.traininglog; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
|
||
import org.springframework.security.test.context.support.WithSecurityContext; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@WithSecurityContext(factory = WithMockUserRolesSecurityContextFactory.class) | ||
public @interface WithMockUserRoles { | ||
String[] value() default { "user" }; | ||
} |
15 changes: 15 additions & 0 deletions
15
server/src/test/java/mucsi96/traininglog/WithMockUserRolesSecurityContextFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package mucsi96.traininglog; | ||
|
||
import org.springframework.security.core.context.SecurityContext; | ||
import org.springframework.security.test.context.support.WithSecurityContextFactory; | ||
|
||
import io.github.mucsi96.kubetools.security.TestSecurityConfigurer; | ||
|
||
public class WithMockUserRolesSecurityContextFactory implements WithSecurityContextFactory<WithMockUserRoles> { | ||
|
||
@Override | ||
public SecurityContext createSecurityContext(WithMockUserRoles mockUser) { | ||
return TestSecurityConfigurer.createSecurityContext(mockUser.value()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters