org.opendaylight.aaa.shiro.realm.ODLJdbcRealm Maven / Gradle / Ivy
/*
* Copyright (c) 2016, 2017 Brocade Communications Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.aaa.shiro.realm;
import org.apache.shiro.realm.jdbc.JdbcRealm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Wraps the generic JdbcRealm
provided by Shiro. This allows for
* enhanced logging as well as isolation of all realms in a single package,
* org.opendaylight.aaa.shiro.realm
, which enables easier import
* by consuming servlets. JdbcRealm allows integration of AAA with a generic
* JDBC-supporting data source. This can ease deployment with existing OSS
* systems.
*
*
* To enabled the ODLJdbcRealm
, modify the realms declaration in
* etc/shiro.ini
as follows:
*
* ds = com.mysql.jdbc.Driver
* ds.serverName = localhost
* ds.user = user
* ds.password = password
* ds.databaseName = db_name
* jdbcRealm = ODLJdbcRealm
* jdbcRealm.dataSource = $ds
* jdbcRealm.authenticationQuery = "SELECT password FROM users WHERE user_name = ?"
* jdbcRealm.userRolesQuery = "SELECT role_name FROM user_rolesWHERE user_name = ?"
* ...
* securityManager.realms = $tokenAuthRealm, $jdbcRealm
*
* Note that the values you use for these fields will likely differ from the
* ones provided above based on your particular deployment scenario.
*/
public class ODLJdbcRealm extends JdbcRealm {
private static final Logger LOG = LoggerFactory.getLogger(ODLJdbcRealm.class);
public ODLJdbcRealm() {
LOG.debug("Creating an instance of ODLJdbcRealm to use with AAA");
}
}