[java-identity-provider] branch master updated: IDP-1269 Update cryptacular with PRNG fix.

Marvin S. Addison marvin.addison at gmail.com
Mon Apr 23 16:46:05 EDT 2018


This is an automated email from the git hooks/post-receive script.

serac pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=e33a94a636c3affd6dfdec2407dfae0ecaa89afc

The following commit(s) were added to refs/heads/master by this push:
       new  e33a94a   IDP-1269 Update cryptacular with PRNG fix.
e33a94a is described below

commit e33a94a636c3affd6dfdec2407dfae0ecaa89afc
Author: Marvin S. Addison <serac at vt.edu>
AuthorDate: Mon Apr 23 15:14:14 2018 -0400

    IDP-1269 Update cryptacular with PRNG fix.
    
    Also use an instance variable to hold the underlying cryptacular
    ID generator component so it is initialized/seeded exactly once at
    startup.
---
 idp-cas-impl/pom.xml                                               | 5 +++++
 .../idp/cas/ticket/impl/TicketIdentifierGenerationStrategy.java    | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/idp-cas-impl/pom.xml b/idp-cas-impl/pom.xml
index 5c9f031..0b91d39 100644
--- a/idp-cas-impl/pom.xml
+++ b/idp-cas-impl/pom.xml
@@ -56,6 +56,11 @@
             <groupId>net.shibboleth.ext</groupId>
             <artifactId>spring-extensions</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.cryptacular</groupId>
+            <artifactId>cryptacular</artifactId>
+            <version>1.1.3-SNAPSHOT</version>
+        </dependency>
 
         <!-- Provided Dependencies -->
 
diff --git a/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/ticket/impl/TicketIdentifierGenerationStrategy.java b/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/ticket/impl/TicketIdentifierGenerationStrategy.java
index bc47fb4..1f67564 100644
--- a/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/ticket/impl/TicketIdentifierGenerationStrategy.java
+++ b/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/ticket/impl/TicketIdentifierGenerationStrategy.java
@@ -30,6 +30,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 import net.shibboleth.utilities.java.support.security.IdentifierGenerationStrategy;
 
+import org.cryptacular.generator.IdGenerator;
 import org.cryptacular.generator.RandomIdGenerator;
 
 /**
@@ -45,6 +46,9 @@ import org.cryptacular.generator.RandomIdGenerator;
  */
 public class TicketIdentifierGenerationStrategy implements IdentifierGenerationStrategy {
 
+    /** Generator for random part of the ticket. */
+    private final IdGenerator idGenerator;
+
     /** Ticket prefix. */
     @Nonnull
     @NotEmpty
@@ -73,6 +77,7 @@ public class TicketIdentifierGenerationStrategy implements IdentifierGenerationS
         if (!isUrlSafe(this.ticketPrefix)) {
             throw new IllegalArgumentException("Unsupported prefix " + this.ticketPrefix);
         }
+        idGenerator = new RandomIdGenerator(ticketLength);
     }
 
     /**
@@ -96,7 +101,7 @@ public class TicketIdentifierGenerationStrategy implements IdentifierGenerationS
         final StringBuilder builder = new StringBuilder(ticketLength * 2);
         builder.append(ticketPrefix).append('-');
         builder.append(System.currentTimeMillis()).append('-');
-        builder.append(new RandomIdGenerator(ticketLength).generate());
+        builder.append(idGenerator.generate());
         if (ticketSuffix != null) {
             builder.append('-').append(ticketSuffix);
         }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list