Align packages to keep IDEs from barfing.
Change-Id: Ie037a1b2f1768840861bdc43a466b65aa8f014d7
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
#### Enable Successful/Unsuccessful Authentication Attempts Logging
By default, successful/unsuccessful authentication attempts are NOT logged. This is due to the fact that logging can severely decrease REST performance. To enable logging of successful/unsuccessful REST attempts, issue the following command:
-karaf> log:set DEBUG org.opendaylight.aaa.shiro.filters.AuthenticationListener
+karaf> log:set DEBUG AuthenticationListener
It is possible to add custom AuthenticationListener(s) to the Shiro based configuration, allowing different ways to listen for successful/unsuccessful authentication attempts. Custom AuthenticationListener(s) must implement the org.apache.shiro.authc.AuthenticationListener interface.
import org.opendaylight.aaa.api.SHA256Calculator;
import org.opendaylight.aaa.api.StoreBuilder;
import org.opendaylight.aaa.api.model.User;
-import org.opendaylight.aaa.impl.datastore.h2.H2Store;
-import org.opendaylight.aaa.impl.datastore.h2.IdmLightConfig;
-import org.opendaylight.aaa.impl.datastore.h2.IdmLightConfigBuilder;
-import org.opendaylight.aaa.impl.datastore.h2.IdmLightSimpleConnectionProvider;
+import org.opendaylight.aaa.datastore.h2.H2Store;
+import org.opendaylight.aaa.datastore.h2.IdmLightConfig;
+import org.opendaylight.aaa.datastore.h2.IdmLightConfigBuilder;
+import org.opendaylight.aaa.datastore.h2.IdmLightSimpleConnectionProvider;
/**
* AAA CLI interface.
import org.opendaylight.aaa.api.model.User;
import org.opendaylight.aaa.api.model.Users;
import org.opendaylight.aaa.cli.utils.CliUtils;
-import org.opendaylight.aaa.impl.shiro.idm.IdmLightProxy;
+import org.opendaylight.aaa.shiro.idm.IdmLightProxy;
@Command(name = "change-user-pwd", scope = "aaa", description = "Change the user password.")
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.utils.DataStoreUtils;
-import org.opendaylight.aaa.impl.shiro.idm.IdmLightProxy;
+import org.opendaylight.aaa.shiro.idm.IdmLightProxy;
@Command(name = "remove-domain", scope = "aaa", description = "Remove domain.")
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.utils.DataStoreUtils;
-import org.opendaylight.aaa.impl.shiro.idm.IdmLightProxy;
+import org.opendaylight.aaa.shiro.idm.IdmLightProxy;
@Command(name = "remove-grant", scope = "aaa", description = "Remove grant.")
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.utils.DataStoreUtils;
-import org.opendaylight.aaa.impl.shiro.idm.IdmLightProxy;
+import org.opendaylight.aaa.shiro.idm.IdmLightProxy;
@Command(name = "remove-role", scope = "aaa", description = "Remove role.")
import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
import org.opendaylight.aaa.cli.utils.CliUtils;
import org.opendaylight.aaa.cli.utils.DataStoreUtils;
-import org.opendaylight.aaa.impl.shiro.idm.IdmLightProxy;
+import org.opendaylight.aaa.shiro.idm.IdmLightProxy;
@Command(name = "remove-user", scope = "aaa", description = "Remove user.")
* 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.impl;
+package org.opendaylight.aaa;
-import org.opendaylight.aaa.impl.shiro.ServiceProxy;
+import org.opendaylight.aaa.shiro.ServiceProxy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*/
public class AAAShiroProvider {
- private static final Logger LOG = LoggerFactory.getLogger(AAAShiroProvider.class);
+ private static final Logger LOG = LoggerFactory.getLogger(org.opendaylight.aaa.shiro.AAAShiroProvider.class);
/**
* Method called when the blueprint container is created.
xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
odl:use-default-for-reference-types="true">
- <bean id="provider" class="org.opendaylight.aaa.impl.AAAShiroProvider"
+ <bean id="provider" class="org.opendaylight.aaa.shiro.AAAShiroProvider"
init-method="init" destroy-method="close" />
</blueprint>
<instructions>
<Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
<Export-Package>
- org.opendaylight.aaa.impl.shiro,
- org.opendaylight.aaa.impl.shiro.idm,
- org.opendaylight.aaa.impl.shiro.tokenauthrealm,
- org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth,
+ org.opendaylight.aaa.shiro,
+ org.opendaylight.aaa.shiro.idm,
+ org.opendaylight.aaa.shiro.tokenauthrealm,
+ org.opendaylight.aaa.shiro.tokenauthrealm.auth,
org.opendaylight.aaa.shiro,
org.opendaylight.aaa.shiro.filters,
org.opendaylight.aaa.shiro.realm,
org.opendaylight.aaa.shiro.web.env,
- org.opendaylight.aaa.impl.datastore.h2.*,
+ org.opendaylight.aaa.datastore.h2.*,
</Export-Package>
<Import-Package>
com.google.*,
* 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.impl.datastore.h2;
+package org.opendaylight.aaa.datastore.h2;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
* 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.impl.datastore.h2;
+package org.opendaylight.aaa.datastore.h2;
import java.sql.Connection;
import javax.sql.DataSource;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.datastore.h2;
+package org.opendaylight.aaa.datastore.h2;
import com.google.common.base.Preconditions;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.datastore.h2;
+package org.opendaylight.aaa.datastore.h2;
import java.sql.Connection;
import java.sql.PreparedStatement;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.datastore.h2;
+package org.opendaylight.aaa.datastore.h2;
import org.opendaylight.aaa.api.IDMStoreException;
import org.opendaylight.aaa.api.IDMStoreUtil;
* 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.impl.datastore.h2;
+package org.opendaylight.aaa.datastore.h2;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.datastore.h2;
+package org.opendaylight.aaa.datastore.h2;
import java.io.File;
import org.immutables.value.Value;
* 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.impl.datastore.h2;
+package org.opendaylight.aaa.datastore.h2;
import java.sql.Connection;
import java.sql.DriverManager;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.datastore.h2;
+package org.opendaylight.aaa.datastore.h2;
import com.google.common.base.Preconditions;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.datastore.h2;
+package org.opendaylight.aaa.datastore.h2;
/**
* Exception indicating an error in an H2 data store.
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.datastore.h2;
+package org.opendaylight.aaa.datastore.h2;
import com.google.common.base.Preconditions;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.datastore.mdsal;
+package org.opendaylight.aaa.datastore.mdsal;
import org.opendaylight.aaa.api.IDMStoreException;
import org.opendaylight.aaa.api.IIDMStore;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.datastore.mdsal;
+package org.opendaylight.aaa.datastore.mdsal;
import org.opendaylight.aaa.api.Authentication;
import org.opendaylight.aaa.api.TokenStore;
* 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.impl;
+package org.opendaylight.aaa.shiro;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import org.opendaylight.aaa.api.TokenAuth;
import org.opendaylight.aaa.api.TokenStore;
import org.opendaylight.aaa.cert.api.ICertificateManager;
-import org.opendaylight.aaa.impl.datastore.h2.H2Store;
-import org.opendaylight.aaa.impl.datastore.h2.H2TokenStore;
-import org.opendaylight.aaa.impl.datastore.h2.IdmLightConfig;
-import org.opendaylight.aaa.impl.datastore.h2.IdmLightConfigBuilder;
-import org.opendaylight.aaa.impl.datastore.h2.IdmLightSimpleConnectionProvider;
-import org.opendaylight.aaa.impl.datastore.mdsal.MdsalStore;
-import org.opendaylight.aaa.impl.datastore.mdsal.MdsalTokenStore;
-import org.opendaylight.aaa.impl.shiro.oauth2.OAuth2TokenServlet;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.ServiceLocator;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.AuthenticationManager;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.HttpBasicAuth;
+import org.opendaylight.aaa.datastore.h2.H2Store;
+import org.opendaylight.aaa.datastore.h2.H2TokenStore;
+import org.opendaylight.aaa.datastore.h2.IdmLightConfig;
+import org.opendaylight.aaa.datastore.h2.IdmLightConfigBuilder;
+import org.opendaylight.aaa.datastore.h2.IdmLightSimpleConnectionProvider;
+import org.opendaylight.aaa.shiro.oauth2.OAuth2TokenServlet;
+import org.opendaylight.aaa.shiro.tokenauthrealm.ServiceLocator;
+import org.opendaylight.aaa.shiro.tokenauthrealm.auth.AuthenticationManager;
+import org.opendaylight.aaa.shiro.tokenauthrealm.auth.HttpBasicAuth;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.yang.gen.v1.urn.opendaylight.aaa.app.config.rev170619.DatastoreConfig;
import org.opendaylight.yang.gen.v1.urn.opendaylight.aaa.app.config.rev170619.ShiroConfiguration;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro;
+package org.opendaylight.aaa.shiro;
import org.opendaylight.aaa.shiro.filters.AAAFilter;
import org.slf4j.Logger;
* @see <a
* href="https://github.com/opendaylight/netconf/blob/master/opendaylight/restconf/sal-rest-connector/src/main/resources/WEB-INF/web.xml">resconf
* web,xml</a>
- * @see <code>org.opendaylight.aaa.shiro.filters.AAAFilter</code>
+ * @see <code>AAAFilter</code>
*/
public class ServiceProxy {
import org.apache.shiro.web.servlet.ShiroFilter;
import org.opendaylight.aaa.api.AAAService;
-import org.opendaylight.aaa.impl.shiro.ServiceProxy;
+import org.opendaylight.aaa.shiro.ServiceProxy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* delivering debug information; to enable these debug statements, please issue
* the following in the karaf shell:
*
- * <code>log:set DEBUG org.opendaylight.aaa.shiro.filters.AAAFilter</code>
+ * <code>log:set DEBUG AAAFilter</code>
*
* @see <code>javax.servlet.Filter</code>
* @see <code>org.apache.shiro.web.servlet.ShiroFilter</code>
* This class is also responsible for delivering debug information; to enable these
* debug statements, please issue the following in the karaf shell:
*
- * <code>log:set DEBUG org.opendaylight.aaa.shiro.filters.AAAShiroFilter</code>
+ * <code>log:set DEBUG AAAShiroFilter</code>
*
* @see <code>javax.servlet.Filter</code>
* @see <code>org.apache.shiro.web.servlet.ShiroFilter</code>
import org.opendaylight.aaa.api.Authentication;
import org.opendaylight.aaa.api.Claim;
import org.opendaylight.aaa.shiro.moon.MoonPrincipal;
-import org.opendaylight.aaa.impl.shiro.oauth2.OAuthRequest;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.ServiceLocator;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.AuthenticationBuilder;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.ClaimBuilder;
+import org.opendaylight.aaa.shiro.oauth2.OAuthRequest;
+import org.opendaylight.aaa.shiro.tokenauthrealm.ServiceLocator;
+import org.opendaylight.aaa.shiro.tokenauthrealm.auth.AuthenticationBuilder;
+import org.opendaylight.aaa.shiro.tokenauthrealm.auth.ClaimBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* This behavior is enabled by default for backwards compatibility. To disable
* OAuth2 functionality, just comment out the following line from the
* <code>etc/shiro.ini</code> file:
- * <code>authcBasic = org.opendaylight.aaa.shiro.filters.ODLHttpAuthenticationFilter</code>
+ * <code>authcBasic = ODLHttpAuthenticationFilter</code>
* then restart the karaf container.
*/
public class ODLHttpAuthenticationFilter extends BasicHttpAuthenticationFilter {
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.idm;
+package org.opendaylight.aaa.shiro.idm;
import java.util.ArrayList;
import java.util.List;
import org.opendaylight.aaa.api.model.User;
import org.opendaylight.aaa.api.model.UserPwd;
import org.opendaylight.aaa.api.model.Users;
-import org.opendaylight.aaa.impl.AAAShiroProvider;
+import org.opendaylight.aaa.shiro.AAAShiroProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.idm;
+package org.opendaylight.aaa.shiro.idm;
import java.util.Arrays;
import java.util.HashSet;
* store.
*
* @author liemmn
- * @see <code>org.opendaylight.aaa.impl.shiro.idm.rest.DomainHandler</code>
- * @see <code>org.opendaylight.aaa.impl.shiro.idm.rest.UserHandler</code>
- * @see <code>org.opendaylight.aaa.impl.shiro.idm.rest.RoleHandler</code>
+ * @see <code>org.opendaylight.aaa.shiro.idm.rest.DomainHandler</code>
+ * @see <code>org.opendaylight.aaa.shiro.idm.rest.UserHandler</code>
+ * @see <code>org.opendaylight.aaa.shiro.idm.rest.RoleHandler</code>
*/
public class IdmLightApplication extends Application {
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.idm;
+package org.opendaylight.aaa.shiro.idm;
import com.google.common.base.Preconditions;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+
+import org.opendaylight.aaa.shiro.AAAShiroProvider;
import org.opendaylight.aaa.api.AuthenticationException;
import org.opendaylight.aaa.api.Claim;
import org.opendaylight.aaa.api.CredentialAuth;
import org.opendaylight.aaa.api.model.Role;
import org.opendaylight.aaa.api.model.User;
import org.opendaylight.aaa.api.model.Users;
-import org.opendaylight.aaa.impl.AAAShiroProvider;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.ClaimBuilder;
+import org.opendaylight.aaa.shiro.tokenauthrealm.auth.ClaimBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.idm;
+package org.opendaylight.aaa.shiro.idm;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import org.opendaylight.aaa.shiro.AAAShiroProvider;
import org.opendaylight.aaa.api.IDMStoreException;
import org.opendaylight.aaa.api.model.IDMError;
import org.opendaylight.aaa.api.model.Role;
import org.opendaylight.aaa.api.model.Roles;
-import org.opendaylight.aaa.impl.AAAShiroProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.idm;
+package org.opendaylight.aaa.shiro.idm;
import java.util.Collection;
import org.opendaylight.aaa.api.model.IDMError;
import org.opendaylight.aaa.api.model.User;
import org.opendaylight.aaa.api.model.Users;
-import org.opendaylight.aaa.impl.AAAShiroProvider;
+import org.opendaylight.aaa.shiro.AAAShiroProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.keystone.domain;
+package org.opendaylight.aaa.shiro.keystone.domain;
/**
* This class is a representation of a Keystone API v3 Auth object.
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.keystone.domain;
+package org.opendaylight.aaa.shiro.keystone.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.oauth2;
+package org.opendaylight.aaa.shiro.oauth2;
import javax.servlet.http.HttpServletRequest;
import org.apache.oltu.oauth2.common.OAuth;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.oauth2;
+package org.opendaylight.aaa.shiro.oauth2;
import javax.servlet.http.HttpServletRequest;
import org.apache.oltu.oauth2.common.OAuth;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.oauth2;
+package org.opendaylight.aaa.shiro.oauth2;
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static javax.servlet.http.HttpServletResponse.SC_CREATED;
import org.opendaylight.aaa.api.AuthenticationException;
import org.opendaylight.aaa.api.Claim;
import org.opendaylight.aaa.api.PasswordCredentials;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.ServiceLocator;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.AuthenticationBuilder;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.ClaimBuilder;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.PasswordCredentialBuilder;
+import org.opendaylight.aaa.shiro.tokenauthrealm.ServiceLocator;
+import org.opendaylight.aaa.shiro.tokenauthrealm.auth.AuthenticationBuilder;
+import org.opendaylight.aaa.shiro.tokenauthrealm.auth.ClaimBuilder;
+import org.opendaylight.aaa.shiro.tokenauthrealm.auth.PasswordCredentialBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.oauth2;
+package org.opendaylight.aaa.shiro.oauth2;
import javax.servlet.http.HttpServletRequest;
import org.apache.oltu.oauth2.as.request.AbstractOAuthTokenRequest;
* 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.impl.shiro.principal;
+package org.opendaylight.aaa.shiro.principal;
import java.util.Set;
package org.opendaylight.aaa.shiro.realm;
-import static org.opendaylight.aaa.impl.shiro.principal.ODLPrincipalImpl.createODLPrincipal;
+import static org.opendaylight.aaa.shiro.principal.ODLPrincipalImpl.createODLPrincipal;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import com.google.common.cache.CacheBuilder;
import org.apache.shiro.subject.PrincipalCollection;
import org.opendaylight.aaa.api.shiro.principal.ODLPrincipal;
import org.opendaylight.aaa.cert.api.ICertificateManager;
-import org.opendaylight.aaa.impl.AAAShiroProvider;
-import org.opendaylight.aaa.impl.shiro.keystone.domain.KeystoneAuth;
-import org.opendaylight.aaa.impl.shiro.keystone.domain.KeystoneToken;
-import org.opendaylight.aaa.impl.shiro.realm.util.http.SimpleHttpClient;
-import org.opendaylight.aaa.impl.shiro.realm.util.http.SimpleHttpRequest;
-import org.opendaylight.aaa.impl.shiro.realm.util.http.UntrustedSSL;
+import org.opendaylight.aaa.shiro.AAAShiroProvider;
+import org.opendaylight.aaa.shiro.keystone.domain.KeystoneAuth;
+import org.opendaylight.aaa.shiro.keystone.domain.KeystoneToken;
+import org.opendaylight.aaa.shiro.realm.util.http.SimpleHttpClient;
+import org.opendaylight.aaa.shiro.realm.util.http.SimpleHttpRequest;
+import org.opendaylight.aaa.shiro.realm.util.http.UntrustedSSL;
+import org.opendaylight.aaa.shiro.principal.ODLPrincipalImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
.collect(Collectors.toSet());
final String userId = username + USERNAME_DOMAIN_SEPARATOR + domain;
- final ODLPrincipal odlPrincipal = createODLPrincipal(username, domain, userId, theRoles);
+ final ODLPrincipal odlPrincipal = ODLPrincipalImpl.createODLPrincipal(username, domain, userId, theRoles);
return new SimpleAuthenticationInfo(odlPrincipal, password.toCharArray(), getName());
}
import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authz.AuthorizationFilter;
-import org.opendaylight.aaa.impl.AAAShiroProvider;
+import org.opendaylight.aaa.shiro.AAAShiroProvider;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
+import org.opendaylight.aaa.shiro.AAAShiroProvider;
import org.opendaylight.aaa.api.SHA256Calculator;
import org.opendaylight.aaa.api.shiro.principal.ODLPrincipal;
-import org.opendaylight.aaa.impl.AAAShiroProvider;
-import org.opendaylight.aaa.impl.shiro.principal.ODLPrincipalImpl;
-import org.opendaylight.aaa.impl.shiro.realm.util.TokenUtils;
+import org.opendaylight.aaa.shiro.principal.ODLPrincipalImpl;
+import org.opendaylight.aaa.shiro.realm.util.TokenUtils;
import org.opendaylight.aaa.shiro.realm.util.http.header.HeaderUtils;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
*
* To enable the <code>ODLActiveDirectoryRealm</code>, modify the realms
* declaration in <code>etc/shiro.ini</code> as follows:
- * <code>adRealm = org.opendaylight.aaa.shiro.realm.ODLActiveDirectoryRealm
+ * <code>adRealm = ODLActiveDirectoryRealm
* adRealm.searchBase = "CN=Users,DC=example,DC=com"
* adRealm.systemUsername = aduser@example.com
* adRealm.systemPassword = adpassword
* ds.user = user
* ds.password = password
* ds.databaseName = db_name
- * jdbcRealm = org.opendaylight.aaa.shiro.realm.ODLJdbcRealm
+ * jdbcRealm = ODLJdbcRealm
* jdbcRealm.dataSource = $ds
* jdbcRealm.authenticationQuery = "SELECT password FROM users WHERE user_name = ?"
* jdbcRealm.userRolesQuery = "SELECT role_name FROM user_rolesWHERE user_name = ?"
* additional Authorization capabilities. To enable this Realm, add the
* following to <code>shiro.ini</code>:
*
- *<code>#ldapRealm = org.opendaylight.aaa.shiro.realm.ODLJndiLdapRealmAuthNOnly
+ *<code>#ldapRealm = ODLJndiLdapRealmAuthNOnly
*#ldapRealm.userDnTemplate = uid={0},ou=People,dc=DOMAIN,dc=TLD
*#ldapRealm.contextFactory.url = ldap://URL:389
*#ldapRealm.searchBase = dc=DOMAIN,dc=TLD
* are not sufficient, alternatives can be derived through enabling
* <code>TRACE</code> level logging. To enable <code>TRACE</code> level
* logging, issue the following command in the karaf shell:
- * <code>log:set TRACE org.opendaylight.aaa.shiro.realm.ODLJndiLdapRealm</code>
+ * <code>log:set TRACE ODLJndiLdapRealm</code>
*
* @see <code>org.apache.shiro.realm.ldap.JndiLdapRealm</code>
* @see <a
import java.util.Map;
import org.opendaylight.aaa.api.TokenStore;
import org.opendaylight.aaa.api.shiro.principal.ODLPrincipal;
-import org.opendaylight.aaa.impl.shiro.principal.ODLPrincipalImpl;
+import org.opendaylight.aaa.shiro.principal.ODLPrincipalImpl;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.subject.PrincipalCollection;
import org.opendaylight.aaa.api.Authentication;
import org.opendaylight.aaa.api.TokenAuth;
-import org.opendaylight.aaa.impl.shiro.realm.util.TokenUtils;
+import org.opendaylight.aaa.shiro.realm.util.TokenUtils;
import org.opendaylight.aaa.shiro.realm.util.http.header.HeaderUtils;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.ServiceLocator;
+import org.opendaylight.aaa.shiro.tokenauthrealm.ServiceLocator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
+
import java.util.Collection;
import java.util.Map;
import java.util.Set;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.realm.util;
+package org.opendaylight.aaa.shiro.realm.util;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.UsernamePasswordToken;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.realm.util.http;
+package org.opendaylight.aaa.shiro.realm.util.http;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.config.ClientConfig;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.realm.util.http;
+package org.opendaylight.aaa.shiro.realm.util.http;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.realm.util.http;
+package org.opendaylight.aaa.shiro.realm.util.http;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.List;
import java.util.Map;
import org.apache.shiro.codec.Base64;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.HttpBasicAuth;
+import org.opendaylight.aaa.shiro.tokenauthrealm.auth.HttpBasicAuth;
/**
* Utilities for HTTP header manipulation.
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.tokenauthrealm;
+package org.opendaylight.aaa.shiro.tokenauthrealm;
import java.util.List;
import java.util.Vector;
* 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.impl.shiro.tokenauthrealm.auth;
+package org.opendaylight.aaa.shiro.tokenauthrealm.auth;
-import static org.opendaylight.aaa.impl.shiro.tokenauthrealm.util.EqualUtil.areEqual;
-import static org.opendaylight.aaa.impl.shiro.tokenauthrealm.util.HashCodeUtil.hash;
+import static org.opendaylight.aaa.shiro.tokenauthrealm.util.EqualUtil.areEqual;
+import static org.opendaylight.aaa.shiro.tokenauthrealm.util.HashCodeUtil.hash;
import java.io.Serializable;
import java.util.Set;
import org.opendaylight.aaa.api.Authentication;
import org.opendaylight.aaa.api.Claim;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.util.HashCodeUtil;
+import org.opendaylight.aaa.shiro.tokenauthrealm.util.HashCodeUtil;
+import org.opendaylight.aaa.shiro.tokenauthrealm.util.EqualUtil;
/**
* A builder for the authentication context.
return false;
}
Authentication authentication = (Authentication) object;
- return areEqual(expiration, authentication.expiration()) && areEqual(claim.roles(), authentication.roles())
- && areEqual(claim.domain(), authentication.domain())
- && areEqual(claim.userId(), authentication.userId())
- && areEqual(claim.user(), authentication.user())
- && areEqual(claim.clientId(), authentication.clientId());
+ return EqualUtil.areEqual(expiration, authentication.expiration()) && EqualUtil.areEqual(claim.roles(), authentication.roles())
+ && EqualUtil.areEqual(claim.domain(), authentication.domain())
+ && EqualUtil.areEqual(claim.userId(), authentication.userId())
+ && EqualUtil.areEqual(claim.user(), authentication.user())
+ && EqualUtil.areEqual(claim.clientId(), authentication.clientId());
}
@Override
public int hashCode() {
if (hashCode == 0) {
int result = HashCodeUtil.SEED;
- result = hash(result, expiration);
- result = hash(result, claim.hashCode());
+ result = HashCodeUtil.hash(result, expiration);
+ result = HashCodeUtil.hash(result, claim.hashCode());
hashCode = result;
}
return hashCode;
* 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.impl.shiro.tokenauthrealm.auth;
+package org.opendaylight.aaa.shiro.tokenauthrealm.auth;
import java.util.Dictionary;
import java.util.Hashtable;
* 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.impl.shiro.tokenauthrealm.auth;
+package org.opendaylight.aaa.shiro.tokenauthrealm.auth;
-import static org.opendaylight.aaa.impl.shiro.tokenauthrealm.util.EqualUtil.areEqual;
-import static org.opendaylight.aaa.impl.shiro.tokenauthrealm.util.HashCodeUtil.hash;
+import static org.opendaylight.aaa.shiro.tokenauthrealm.util.EqualUtil.areEqual;
+import static org.opendaylight.aaa.shiro.tokenauthrealm.util.HashCodeUtil.hash;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import java.util.LinkedHashSet;
import java.util.Set;
import org.opendaylight.aaa.api.Claim;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.util.HashCodeUtil;
+import org.opendaylight.aaa.shiro.tokenauthrealm.util.HashCodeUtil;
/**
* Builder for a {@link Claim}. The userId, user, and roles information is
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth;
+package org.opendaylight.aaa.shiro.tokenauthrealm.auth;
import java.util.Base64;
import java.util.List;
import org.opendaylight.aaa.api.CredentialAuth;
import org.opendaylight.aaa.api.PasswordCredentials;
import org.opendaylight.aaa.api.TokenAuth;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.ServiceLocator;
+import org.opendaylight.aaa.shiro.tokenauthrealm.ServiceLocator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* 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.impl.shiro.tokenauthrealm.auth;
+package org.opendaylight.aaa.shiro.tokenauthrealm.auth;
-import static org.opendaylight.aaa.impl.shiro.tokenauthrealm.util.EqualUtil.areEqual;
-import static org.opendaylight.aaa.impl.shiro.tokenauthrealm.util.HashCodeUtil.hash;
+import static org.opendaylight.aaa.shiro.tokenauthrealm.util.EqualUtil.areEqual;
+import static org.opendaylight.aaa.shiro.tokenauthrealm.util.HashCodeUtil.hash;
import org.opendaylight.aaa.api.PasswordCredentials;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.util.HashCodeUtil;
+import org.opendaylight.aaa.shiro.tokenauthrealm.util.HashCodeUtil;
+import org.opendaylight.aaa.shiro.tokenauthrealm.util.EqualUtil;
/**
* {@link PasswordCredentials} builder.
return false;
}
PasswordCredentials passwordCredentials = (PasswordCredentials) object;
- return areEqual(username, passwordCredentials.username())
- && areEqual(password, passwordCredentials.password());
+ return EqualUtil.areEqual(username, passwordCredentials.username())
+ && EqualUtil.areEqual(password, passwordCredentials.password());
}
@Override
public int hashCode() {
if (hashCode == 0) {
int result = HashCodeUtil.SEED;
- result = hash(result, username);
- result = hash(result, password);
+ result = HashCodeUtil.hash(result, username);
+ result = HashCodeUtil.hash(result, password);
hashCode = result;
}
return hashCode;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.tokenauthrealm.util;
+package org.opendaylight.aaa.shiro.tokenauthrealm.util;
/**
* Simple class to aide in implementing equals.
* and is available at http://www.eclipse.org/legal/epl-v10.html
*****************************************************************************/
-package org.opendaylight.aaa.impl.shiro.tokenauthrealm.util;
+package org.opendaylight.aaa.shiro.tokenauthrealm.util;
import java.lang.reflect.Array;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.util.Factory;
import org.apache.shiro.web.env.IniWebEnvironment;
-import org.opendaylight.aaa.impl.AAAShiroProvider;
+import org.opendaylight.aaa.shiro.AAAShiroProvider;
import org.opendaylight.yang.gen.v1.urn.opendaylight.aaa.app.config.rev170619.ShiroConfiguration;
import org.opendaylight.yang.gen.v1.urn.opendaylight.aaa.app.config.rev170619.shiro.configuration.Main;
import org.opendaylight.yang.gen.v1.urn.opendaylight.aaa.app.config.rev170619.shiro.configuration.Urls;
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
- <param-value>org.opendaylight.aaa.impl.shiro.idm.IdmLightApplication</param-value>
+ <param-value>org.opendaylight.aaa.shiro.idm.IdmLightApplication</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name><param-value>true</param-value>
<!-- Start ldapRealm commented out
<main>
<pair-key>ldapRealm</pair-key>
- <pair-value>org.opendaylight.aaa.shiro.realm.ODLJndiLdapRealmAuthNOnly</pair-value>
+ <pair-value>ODLJndiLdapRealmAuthNOnly</pair-value>
</main>
<main>
<pair-key>ldapRealm.userDnTemplate</pair-key>
<!-- Start adRealm commented out
<main>
<pair-key>adRealm</pair-key>
- <pair-value>org.opendaylight.aaa.shiro.realm.ODLActiveDirectoryRealm</pair-value>
+ <pair-value>ODLActiveDirectoryRealm</pair-value>
</main>
<main>
<pair-key>adRealm.searchBase</pair-key>
</main>
<main>
<pair-key>jdbcRealm</pair-key>
- <pair-value>org.opendaylight.aaa.shiro.realm.ODLJdbcRealm</pair-value>
+ <pair-value>ODLJdbcRealm</pair-value>
</main>
<main>
<pair-key>jdbcRealm.dataSource</pair-key>
<!-- Start mdsalRealm commented out
<main>
<pair-key>mdsalRealm</pair-key>
- <pair-value>org.opendaylight.aaa.shiro.realm.MdsalRealm</pair-value>
+ <pair-value>MdsalRealm</pair-value>
</main>
End mdsalRealm commented out-->
<!-- Start moonAuthRealm commented out
<main>
<pair-key>moonAuthRealm</pair-key>
- <pair-value>org.opendaylight.aaa.shiro.realm.MoonRealm</pair-value>
+ <pair-value>MoonRealm</pair-value>
</main>
<main>
<pair-key>moonAuthRealm.moonServerURL</pair-key>
<!-- Start keystoneAuthRealm commented out
<main>
<pair-key>keystoneAuthRealm</pair-key>
- <pair-value>org.opendaylight.aaa.shiro.realm.KeystoneAuthRealm</pair-value>
+ <pair-value>KeystoneAuthRealm</pair-value>
</main>
<main>
<pair-key>keystoneAuthRealm.url</pair-key>
<!-- Start moonAuthRealm commented out
<main>
<pair-key>rest</pair-key>
- <pair-value>org.opendaylight.aaa.shiro.filters.MoonOAuthFilter</pair-value>
+ <pair-value>MoonOAuthFilter</pair-value>
</main>
End moonAuthRealm commented out-->
default-config-file-name="aaa-datastore-config.xml"
binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.aaa.app.config.rev170619.DatastoreConfig" />
- <bean id="IdmLightProxy" class="org.opendaylight.aaa.impl.shiro.idm.IdmLightProxy">
+ <bean id="IdmLightProxy" class="org.opendaylight.aaa.shiro.idm.IdmLightProxy">
</bean>
<service ref="IdmLightProxy" interface="org.opendaylight.aaa.api.IdMService" odl:type="default"/>
</cm:property-placeholder>
<bean id="provider"
- class="org.opendaylight.aaa.impl.AAAShiroProvider" factory-method="newInstance"
- init-method="init" destroy-method="close">
+ class="org.opendaylight.aaa.shiro.AAAShiroProvider" factory-method="newInstance"
+ init-method="init" destroy-method="close">
<argument ref="dataBroker" />
<argument ref="certManager" />
<argument ref="IdmLightProxy" />
import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.aaa.api.model.Domains;
-import org.opendaylight.aaa.impl.datastore.h2.ConnectionProvider;
-import org.opendaylight.aaa.impl.datastore.h2.DomainStore;
public class DomainStoreTest {
import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.aaa.api.model.Grants;
-import org.opendaylight.aaa.impl.datastore.h2.ConnectionProvider;
-import org.opendaylight.aaa.impl.datastore.h2.GrantStore;
public class GrantStoreTest {
import org.opendaylight.aaa.api.model.Grant;
import org.opendaylight.aaa.api.model.Role;
import org.opendaylight.aaa.api.model.User;
-import org.opendaylight.aaa.impl.datastore.h2.DomainStore;
-import org.opendaylight.aaa.impl.datastore.h2.GrantStore;
-import org.opendaylight.aaa.impl.datastore.h2.H2Store;
-import org.opendaylight.aaa.impl.datastore.h2.IdmLightConfigBuilder;
-import org.opendaylight.aaa.impl.datastore.h2.IdmLightSimpleConnectionProvider;
-import org.opendaylight.aaa.impl.datastore.h2.RoleStore;
-import org.opendaylight.aaa.impl.datastore.h2.StoreException;
-import org.opendaylight.aaa.impl.datastore.h2.UserStore;
public class H2StoreTest {
import org.junit.After;
import org.junit.Test;
import org.opendaylight.aaa.api.Authentication;
-import org.opendaylight.aaa.impl.datastore.h2.H2TokenStore;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.AuthenticationBuilder;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.ClaimBuilder;
+import org.opendaylight.aaa.shiro.tokenauthrealm.auth.AuthenticationBuilder;
+import org.opendaylight.aaa.shiro.tokenauthrealm.auth.ClaimBuilder;
/**
* Unit Test for H2TokenStore.
import static com.google.common.truth.Truth.assertThat;
import org.junit.Test;
-import org.opendaylight.aaa.impl.datastore.h2.IdmLightConfig;
-import org.opendaylight.aaa.impl.datastore.h2.IdmLightConfigBuilder;
/**
* Unit test for IdmLightConfig.
import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.aaa.api.model.Roles;
-import org.opendaylight.aaa.impl.datastore.h2.ConnectionProvider;
-import org.opendaylight.aaa.impl.datastore.h2.RoleStore;
public class RoleStoreTest {
import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.aaa.api.model.Users;
-import org.opendaylight.aaa.impl.datastore.h2.ConnectionProvider;
-import org.opendaylight.aaa.impl.datastore.h2.UserStore;
public class UserStoreTest {
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro;
+package org.opendaylight.aaa.shiro;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
+import org.opendaylight.aaa.shiro.ServiceProxy;
import org.opendaylight.aaa.shiro.filters.AAAFilter;
public class ServiceProxyTest {
import org.apache.shiro.authc.UsernamePasswordToken;
import org.junit.Test;
import org.opendaylight.aaa.shiro.TestAppender;
-import org.opendaylight.aaa.shiro.filters.AuthenticationListener;
/**
* Test AuthenticationListener, which is responsible for logging Accounting events.
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.junit.Test;
-import org.opendaylight.aaa.shiro.filters.AuthenticationTokenUtils;
/**
* Tests authentication token output utilities.
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.idm.persistence;
+package org.opendaylight.aaa.shiro.idm.persistence;
import java.util.ArrayList;
import java.util.LinkedList;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
+import org.opendaylight.aaa.shiro.AAAShiroProvider;
import org.opendaylight.aaa.api.IDMStoreException;
import org.opendaylight.aaa.api.IIDMStore;
import org.opendaylight.aaa.api.PasswordCredentials;
import org.opendaylight.aaa.api.model.Role;
import org.opendaylight.aaa.api.model.User;
import org.opendaylight.aaa.api.model.Users;
-import org.opendaylight.aaa.impl.shiro.idm.IdmLightProxy;
-import org.opendaylight.aaa.impl.AAAShiroProvider;
+import org.opendaylight.aaa.shiro.idm.IdmLightProxy;
/*
* @Author - Sharon Aicler (saichler@cisco.com)
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.idm.rest.test;
+package org.opendaylight.aaa.shiro.idm.rest.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.idm.rest.test;
+package org.opendaylight.aaa.shiro.idm.rest.test;
import com.sun.jersey.spi.container.servlet.WebComponent;
import com.sun.jersey.test.framework.AppDescriptor;
import com.sun.jersey.test.framework.WebAppDescriptor;
import org.junit.Before;
import org.opendaylight.aaa.api.StoreBuilder;
-import org.opendaylight.aaa.impl.shiro.idm.IdmLightApplication;
-import org.opendaylight.aaa.impl.AAAShiroProvider;
+import org.opendaylight.aaa.shiro.idm.IdmLightApplication;
+import org.opendaylight.aaa.shiro.AAAShiroProvider;
import org.slf4j.bridge.SLF4JBridgeHandler;
public abstract class HandlerTest extends JerseyTest {
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.idm.rest.test;
+package org.opendaylight.aaa.shiro.idm.rest.test;
import java.util.ArrayList;
import java.util.List;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.idm.rest.test;
+package org.opendaylight.aaa.shiro.idm.rest.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.idm.rest.test;
+package org.opendaylight.aaa.shiro.idm.rest.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.oauth2;
+package org.opendaylight.aaa.shiro.oauth2;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import org.opendaylight.aaa.api.PasswordCredentials;
import org.opendaylight.aaa.api.TokenAuth;
import org.opendaylight.aaa.api.TokenStore;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.ServiceLocator;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.AuthenticationBuilder;
-import org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.ClaimBuilder;
+import org.opendaylight.aaa.shiro.tokenauthrealm.ServiceLocator;
+import org.opendaylight.aaa.shiro.tokenauthrealm.auth.AuthenticationBuilder;
+import org.opendaylight.aaa.shiro.tokenauthrealm.auth.ClaimBuilder;
/**
* A unit test for token endpoint.
import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.aaa.shiro.AAAShiroProvider;
import org.opendaylight.aaa.api.shiro.principal.ODLPrincipal;
import org.opendaylight.aaa.cert.api.ICertificateManager;
-import org.opendaylight.aaa.impl.AAAShiroProvider;
-import org.opendaylight.aaa.impl.shiro.keystone.domain.KeystoneAuth;
-import org.opendaylight.aaa.impl.shiro.keystone.domain.KeystoneToken;
-import org.opendaylight.aaa.impl.shiro.realm.util.http.SimpleHttpClient;
-import org.opendaylight.aaa.impl.shiro.realm.util.http.SimpleHttpRequest;
-import org.opendaylight.aaa.impl.shiro.realm.util.http.UntrustedSSL;
+import org.opendaylight.aaa.shiro.keystone.domain.KeystoneAuth;
+import org.opendaylight.aaa.shiro.keystone.domain.KeystoneToken;
+import org.opendaylight.aaa.shiro.realm.util.http.SimpleHttpClient;
+import org.opendaylight.aaa.shiro.realm.util.http.SimpleHttpRequest;
+import org.opendaylight.aaa.shiro.realm.util.http.UntrustedSSL;
import org.osgi.service.http.HttpService;
@RunWith(MockitoJUnitRunner.class)
import org.apache.shiro.subject.Subject;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.aaa.impl.AAAShiroProvider;
+import org.opendaylight.aaa.shiro.AAAShiroProvider;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import java.util.List;
import java.util.Map;
import org.apache.shiro.authc.AuthenticationToken;
-import org.opendaylight.aaa.impl.shiro.realm.util.TokenUtils;
+import org.opendaylight.aaa.shiro.realm.util.TokenUtils;
import org.opendaylight.aaa.shiro.realm.util.http.header.HeaderUtils;
import org.junit.Ignore;
import org.junit.Test;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.realm.util.http;
+package org.opendaylight.aaa.shiro.realm.util.http;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import org.junit.runner.RunWith;
import org.mockito.Answers;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
-import org.opendaylight.aaa.impl.shiro.keystone.domain.KeystoneToken;
+import org.opendaylight.aaa.shiro.keystone.domain.KeystoneToken;
@RunWith(MockitoJUnitRunner.class)
public class SimpleHttpRequestTest {
when(clientResponse.getStatus()).thenReturn(200);
when(clientResponse.getHeaders()).thenReturn(headers);
- SimpleHttpRequest<Response> spiedRequest = spy(request);
+ SimpleHttpRequest<Response> spiedRequest = Mockito.spy(request);
Response response = spiedRequest.execute();
.type(MediaType.APPLICATION_JSON_TYPE)
.method("POST", KeystoneToken.class, "entity"))
.thenReturn(theToken);
- SimpleHttpRequest<KeystoneToken> spiedRequest = spy(request);
+ SimpleHttpRequest<KeystoneToken> spiedRequest = Mockito.spy(request);
KeystoneToken response = spiedRequest.execute();
assertThat(response.getToken().getRoles().size(), is(0));
}
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth;
+package org.opendaylight.aaa.shiro.tokenauthrealm.auth;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth;
+package org.opendaylight.aaa.shiro.tokenauthrealm.auth;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth;
+package org.opendaylight.aaa.shiro.tokenauthrealm.auth;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth;
+package org.opendaylight.aaa.shiro.tokenauthrealm.auth;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth;
+package org.opendaylight.aaa.shiro.tokenauthrealm.auth;
import static org.junit.Assert.assertEquals;