@@ -354,7 +354,6 @@ private AdditionalConfigurations getAdditionalConfigurationsDefaults(final Strin
354354 return new AdditionalConfigurations (additionalConfigurations );
355355 }
356356
357-
358357 private void validatePasswordConfiguration (final IdentityConfiguration identityConfiguration ,
359358 final PasswordConfiguration passwordCofiguration ) throws KuraException {
360359 if (!passwordCofiguration .isPasswordAuthEnabled ()) {
@@ -373,8 +372,7 @@ private void validatePasswordConfiguration(final IdentityConfiguration identityC
373372 .filter (u -> u .getCredentials ().get (PASSWORD_PROPERTY ) != null ).isPresent ();
374373 final boolean hasTemporaryPasswordHash = this .temporaryStore .getIdentity (identityConfiguration .getName ())
375374 .flatMap (config -> config .getComponent (PasswordConfiguration .class ))
376- .flatMap (PasswordConfiguration ::getPasswordHash )
377- .isPresent ();
375+ .flatMap (PasswordConfiguration ::getPasswordHash ).isPresent ();
378376 if (!hasPersistedPasswordHash && !hasTemporaryPasswordHash ) {
379377 throw new KuraException (KuraErrorCode .INVALID_PARAMETER ,
380378 "Password authentication is enabled but no password has been provided or is currently assigned" );
@@ -411,6 +409,15 @@ private void validateAdditionalConfigurations(final IdentityConfiguration identi
411409 public synchronized void createTemporaryIdentity (final String identityName , final Duration lifetime )
412410 throws KuraException {
413411
412+ createTemporaryIdentity (new IdentityConfiguration (identityName , Collections .emptyList ()), lifetime );
413+ }
414+
415+ @ Override
416+ public synchronized void createTemporaryIdentity (final IdentityConfiguration identityConfiguration ,
417+ final Duration lifetime ) throws KuraException {
418+
419+ final String identityName = identityConfiguration .getName ();
420+
414421 ValidationUtil .validateNewIdentityName (identityName );
415422
416423 // Check if identity already exists (temporary or regular)
@@ -429,8 +436,8 @@ public synchronized void createTemporaryIdentity(final String identityName, fina
429436 "Temporary identity lifetime must be positive" );
430437 }
431438
432- this . temporaryIdentityStore . createIdentity ( new IdentityConfiguration ( identityName , Collections . emptyList ()),
433- lifetime );
439+ validateIdentityConfiguration ( identityConfiguration );
440+ this . temporaryIdentityStore . createIdentity ( identityConfiguration , lifetime );
434441
435442 }, "Create temporary identity " + identityName );
436443 }
0 commit comments