1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied.  See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 module hunt.shiro.session.mgt.eis.RandomSessionIdGenerator;
20 
21 // import hunt.shiro.session.Session;
22 // import hunt.logging.Logger;
23 
24 // import hunt.util.Common;
25 // import java.util.Random;
26 
27 // /**
28 //  * Generates session IDs by using a {@link Random} instance to generate random IDs. The default {@code Random}
29 //  * implementation is a {@link java.security.SecureRandom SecureRandom} with the {@code SHA1PRNG} algorithm.
30 //  *
31 //  */
32 // class RandomSessionIdGenerator : SessionIdGenerator {
33 
34 
35 
36 //     private enum string RANDOM_NUM_GENERATOR_ALGORITHM_NAME = "SHA1PRNG";
37 //     private Random random;
38 
39 //     this() {
40 //         try {
41 //             this.random = java.security.SecureRandom.getInstance(RANDOM_NUM_GENERATOR_ALGORITHM_NAME);
42 //         } catch (java.security.NoSuchAlgorithmException e) {
43 //             tracef("The SecureRandom SHA1PRNG algorithm is not available on the current platform.  Using the " ~
44 //                     "platform's default SecureRandom algorithm.", e);
45 //             this.random = new java.security.SecureRandom();
46 //         }
47 //     }
48 
49 //     Random getRandom() {
50 //         return this.random;
51 //     }
52 
53 //     void setRandom(Random random) {
54 //         this.random = random;
55 //     }
56 
57 //     /**
58 //      * Returns the string value of the configured {@link Random}'s {@link Random#nextLong() nextLong()} invocation.
59 //      *
60 //      * @param session the {@link Session} instance to which the ID will be applied.
61 //      * @return the string value of the configured {@link Random}'s {@link Random#nextLong()} invocation.
62 //      */
63 //     string generateId(Session session) {
64 //         //ignore the argument - just call the Random:
65 //         return Long.toString(getRandom().nextLong());
66 //     }
67 // }