6f4b4bb1906a2f5325c842999882168e42969c9b
[moon.git] /
1 /*
2  * Copyright (c) 2014, 2015 Hewlett-Packard Development Company, L.P. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.aaa.keystone;
10
11 import java.util.List;
12 import java.util.Map;
13 import org.opendaylight.aaa.api.Authentication;
14 import org.opendaylight.aaa.api.TokenAuth;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18 /**
19  * A Keystone {@link TokenAuth} filter.
20  *
21  * @author liemmn
22  */
23 public class KeystoneTokenAuth implements TokenAuth {
24     private static final Logger LOG = LoggerFactory.getLogger(KeystoneTokenAuth.class);
25
26     static final String TOKEN = "X-Auth-Token";
27
28     @Override
29     public Authentication validate(Map<String, List<String>> headers) {
30         if (!headers.containsKey(TOKEN)) {
31             return null; // Not a Keystone token
32         }
33
34         // TODO: Call into Keystone to get security context...
35         LOG.info("Not yet validating token {}", headers.get(TOKEN).get(0));
36         return null;
37     }
38
39 }