2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.karafsecurity;
10 import java.security.Principal;
11 import java.util.ArrayList;
12 import java.util.List;
14 import org.apache.catalina.realm.GenericPrincipal;
15 import org.apache.catalina.realm.RealmBase;
17 public class ControllerCustomRealm extends RealmBase {
19 private static final String name = "ControllerCustomRealm";
22 protected String getName() {
27 protected String getPassword(String username) {
32 protected Principal getPrincipal(String username) {
33 List<String> controllerRoles = new ArrayList<String>();
34 controllerRoles.add("System-Admin");
35 return new GenericPrincipal(username, "", controllerRoles);
39 public Principal authenticate(String username, String credentials) {
40 return this.getPrincipal(username);