24ae9238692f7e66cec4500ef3aec815163d1e4c
[moon.git] /
1 /*
2  * Copyright (c) 2014 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.api;
10
11 /**
12  * Authentication service to provide authentication context.
13  */
14 public interface AuthenticationService {
15     /**
16      * Retrieve the current security context, or null if none exists.
17      *
18      * @return security context
19      */
20     Authentication get();
21
22     /**
23      * Set the current security context. Only {@link TokenAuth} should set
24      * security context based on the authentication result.
25      *
26      * @param auth
27      *            security context
28      */
29     void set(Authentication auth);
30
31     /**
32      * Clear the current security context.
33      */
34     void clear();
35
36     /**
37      * Checks to see if authentication is enabled.
38      *
39      * @return true if it is, false otherwise
40      */
41     boolean isAuthEnabled();
42 }