Package org.cyclos.impl.access
Interface PinServiceLocal
-
- All Superinterfaces:
PinService,Service
public interface PinServiceLocal extends PinService
Local interface for devices pins.
-
-
Field Summary
Fields Modifier and Type Field Description static intPRINCIPAL_LENGTHLength in chars of the generated pin's principal.static intSALT_LENGTHLength in chars of the generated pin's salt.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcheckPin(Pin pin, String plainPinValue, ChannelAccessAccessor channelAccess)Checks the plain pin's value sent by a client ensuring it matched the value stored in the givenPinentity.PinensurePin(PinLocatorVO locator)Returns thePinfrom the given locator or (if null) from the current session if authenticated with pin.Pair<Pin,ChannelAccessAccessor>getIfActive(PinLocatorVO pinLocator, Channel channel)Returns both thePinand its channel access configuration for the current channel if it is active: exists, not expired and active on channel.PinlocatePin(PinLocatorVO locator, boolean ownPin)Locates a device pin, either by id or principal.booleanpinEnabled(BasicUser user)Returns whether the given user has at least one channel with PIN enabled.<T extends NetworkedEntity>
voidrelatedEntityRemoved(T entity, Supplier<T> newEntitySupplier)Searches for allPininstances related to the entity being removed and for all of those, sets the new entity obtained from the supplier as the new related one.
If the supplier returns null then all related pins are removed.longremoveExpired()Removes all expired PINs-
Methods inherited from interface org.cyclos.services.access.PinService
getData, getEditData, getPasswordInputForCreate, list, locate, remove, save, set, validate
-
-
-
-
Field Detail
-
PRINCIPAL_LENGTH
static final int PRINCIPAL_LENGTH
Length in chars of the generated pin's principal.- See Also:
- Constant Field Values
-
SALT_LENGTH
static final int SALT_LENGTH
Length in chars of the generated pin's salt.- See Also:
- Constant Field Values
-
-
Method Detail
-
checkPin
void checkPin(Pin pin, String plainPinValue, ChannelAccessAccessor channelAccess)
Checks the plain pin's value sent by a client ensuring it matched the value stored in the givenPinentity.
-
ensurePin
Pin ensurePin(PinLocatorVO locator) throws ValidationException
Returns thePinfrom the given locator or (if null) from the current session if authenticated with pin. Otherwise, if a pin can be obtained then it throws aValidationException.- Throws:
ValidationException
-
getIfActive
Pair<Pin,ChannelAccessAccessor> getIfActive(PinLocatorVO pinLocator, Channel channel)
Returns both thePinand its channel access configuration for the current channel if it is active: exists, not expired and active on channel. Otherwise, returns null.
-
locatePin
Pin locatePin(PinLocatorVO locator, boolean ownPin)
Locates a device pin, either by id or principal. If the ownPin parameter is true then the located pin (if any) must belong to the logged user.
-
pinEnabled
boolean pinEnabled(BasicUser user)
Returns whether the given user has at least one channel with PIN enabled.
-
relatedEntityRemoved
<T extends NetworkedEntity> void relatedEntityRemoved(T entity, Supplier<T> newEntitySupplier)
Searches for allPininstances related to the entity being removed and for all of those, sets the new entity obtained from the supplier as the new related one.
If the supplier returns null then all related pins are removed.
-
removeExpired
long removeExpired()
Removes all expired PINs
-
-