| margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 1 | package de.ids_mannheim.korap.security.context; |
| Michael Hanl | e3fe5cd | 2015-09-24 19:43:57 +0200 | [diff] [blame] | 2 | |
| Michael Hanl | e3fe5cd | 2015-09-24 19:43:57 +0200 | [diff] [blame] | 3 | import java.security.Principal; |
| 4 | |||||
| margaretha | 96c309d | 2023-08-16 12:24:12 +0200 | [diff] [blame] | 5 | import jakarta.ws.rs.core.SecurityContext; |
| 6 | |||||
| Michael Hanl | e3fe5cd | 2015-09-24 19:43:57 +0200 | [diff] [blame] | 7 | /** |
| 8 | * @author hanl | ||||
| 9 | * @date 13/05/2014 | ||||
| Michael Hanl | 8abaf9e | 2016-05-23 16:46:35 +0200 | [diff] [blame] | 10 | * |
| 11 | * wrapper for REST security context | ||||
| 12 | * | ||||
| Michael Hanl | e3fe5cd | 2015-09-24 19:43:57 +0200 | [diff] [blame] | 13 | */ |
| Michael Hanl | cb2d3f9 | 2016-06-02 17:34:06 +0200 | [diff] [blame] | 14 | public class KustvaktContext implements SecurityContext { |
| Michael Hanl | e3fe5cd | 2015-09-24 19:43:57 +0200 | [diff] [blame] | 15 | |
| 16 | private TokenContext user; | ||||
| 17 | |||||
| Michael Hanl | cb2d3f9 | 2016-06-02 17:34:06 +0200 | [diff] [blame] | 18 | public KustvaktContext (final TokenContext user) { |
| Michael Hanl | e3fe5cd | 2015-09-24 19:43:57 +0200 | [diff] [blame] | 19 | this.user = user; |
| 20 | } | ||||
| 21 | |||||
| 22 | @Override | ||||
| Michael Hanl | 8abaf9e | 2016-05-23 16:46:35 +0200 | [diff] [blame] | 23 | public Principal getUserPrincipal () { |
| Michael Hanl | e3fe5cd | 2015-09-24 19:43:57 +0200 | [diff] [blame] | 24 | return this.user; |
| 25 | } | ||||
| 26 | |||||
| 27 | @Override | ||||
| Michael Hanl | 8abaf9e | 2016-05-23 16:46:35 +0200 | [diff] [blame] | 28 | public boolean isUserInRole (String role) { |
| Michael Hanl | e3fe5cd | 2015-09-24 19:43:57 +0200 | [diff] [blame] | 29 | throw new UnsupportedOperationException(); |
| 30 | } | ||||
| 31 | |||||
| 32 | @Override | ||||
| Michael Hanl | 8abaf9e | 2016-05-23 16:46:35 +0200 | [diff] [blame] | 33 | public boolean isSecure () { |
| Michael Hanl | e3fe5cd | 2015-09-24 19:43:57 +0200 | [diff] [blame] | 34 | return false; |
| 35 | } | ||||
| 36 | |||||
| 37 | @Override | ||||
| Michael Hanl | 8abaf9e | 2016-05-23 16:46:35 +0200 | [diff] [blame] | 38 | public String getAuthenticationScheme () { |
| Michael Hanl | e3fe5cd | 2015-09-24 19:43:57 +0200 | [diff] [blame] | 39 | return SecurityContext.BASIC_AUTH; |
| 40 | } | ||||
| 41 | } | ||||