extends AuthFilter principal = authenticator.authenticate(token);
43 | if (principal.isPresent()) {
44 | requestContext.setSecurityContext(new AuthSecurityContext (principal.get(), false));
45 | return;
46 | }
47 | } catch (AuthenticationException e) {
48 | LOGGER.warn("Error authenticating auth token", e);
49 | throw new InternalServerErrorException();
50 | }
51 | }
52 | }
53 | }
54 | } catch (IllegalArgumentException e) {
55 | LOGGER.warn("Error decoding auth token", e);
56 | }
57 | throw new WebApplicationException(unauthorizedHandler.buildResponse(prefix, realm));
58 | }
59 |
60 | public static class Builder extends AuthFilter.AuthFilterBuilder newInstance() {
64 | return new TokenAuthFilter<>();
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/org/whispersystems/textsecuregcm/configuration/ApnConfiguration.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2013 Open WhisperSystems
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Affero General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Affero General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Affero General Public License
15 | * along with this program. If not, see