All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.shiro.subject.PrincipalMap Maven / Gradle / Ivy

There is a newer version: 3.9
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.shiro.subject;

import java.util.Map;

/**
 * EXPERIMENTAL - DO NOT USE YET
 * 

* A {@code PrincipalMap} is map of all of a subject's principals - its identifying attributes like username, userId, * etc. *

* The {@link Map} methods allow you to interact with a unified representation of * all of the Subject's principals, even if they came from different realms. You can think of the {@code Map} methods * as the general purpose API for a Subject's principals. That is, you can access a principal generally: *

 * Object principal = subject.getPrincipals().get(principalName);
 * 
* For example, to get the Subject's username (if the * username principal indeed exists and was populated by a Realm), you can do the following: *
 * String username = (String)subject.getPrincipals().get("username");
 * 
*

Multi-Realm Environments

* If your application uses multiple realms, the {@code Map} methods reflect * the the aggregate principals from all realms that authenticated the owning {@code Subject}. *

* But in these multi-realm environments, it is often convenient or necessary to acquire only the principals contributed * by a specific realm (often in a realm implementation itself). This {@code PrincipalMap} interface satisfies * those needs by providing additional realm-specific accessor/mutator methods. * * @author Les Hazlewood * @since 1.2 */ public interface PrincipalMap extends PrincipalCollection, Map { Map getRealmPrincipals(String realmName); Map setRealmPrincipals(String realmName, Map principals); Object setRealmPrincipal(String realmName, String principalName, Object principal); Object getRealmPrincipal(String realmName, String realmPrincipal); Object removeRealmPrincipal(String realmName, String principalName); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy