Package net.shibboleth.idp.authn.principal

# Class PrincipalServiceManager

java.lang.Object
net.shibboleth.idp.authn.principal.PrincipalServiceManager

public class PrincipalServiceManager extends Object
Manages and exposes instances of the `PrincipalService` interface.

Since:
  4.1.0

## Field Summary

Fields
Modifier and Type
Field
Description
`private final Map<Class<?>,PrincipalService<?>>`
`classIndexedMap`
Service index by class.
`private final Map<String,PrincipalService<?>>`
`idIndexedMap`
Service index by ID.
`private final org.slf4j.Logger`
`log`
Class logger.

## Constructor Summary

Constructors
Constructor
Description
`PrincipalServiceManager(Collection<PrincipalService<?>> services)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`Collection<PrincipalService<?>>`
`all()`
Get all of the registered services.
`<T extends Principal>
PrincipalService<T>`
`byClass(Class<T> claz)`
Get a `PrincipalService` by type.
`Principal`
`principalFromString(String s)`
Manufacture a `Principal` from a string of the format "type/value" where type matches the ID of a `PrincipalService` and the value is supplied to a single-arg String constructor if one exists.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### classIndexedMap

@Nonnull private final Map<Class<?>,PrincipalService<?>> classIndexedMap
Service index by class.

### idIndexedMap

@Nonnull private final Map<String,PrincipalService<?>> idIndexedMap
Service index by ID.

## Constructor Details

### PrincipalServiceManager

@Autowired public PrincipalServiceManager(@Nullable @ParameterName(name="services") Collection<PrincipalService<?>> services)
Constructor.

Parameters:
  `services` - instances to manage

## Method Details

### all

@Nonnull @NotLive @Unmodifiable public Collection<PrincipalService<?>> all()
Get all of the registered services.

Returns:
  all registered services

### byClass

@Nullable public <T extends Principal> PrincipalService<T> byClass(@Nonnull Class<T> claz)
Get a `PrincipalService` by type.

Type Parameters:
  `T` - class type
Parameters:
  `claz` - class type
Returns:
  service for the type, or null

### principalFromString

@Nullable public Principal principalFromString(@Nonnull @NotEmpty String s)
Manufacture a `Principal` from a string of the format "type/value" where type matches the ID of a `PrincipalService` and the value is supplied to a single-arg String constructor if one exists.

Parameters:
  `s` - the delimited form above
Returns:
  the new object or null