Example usage for org.apache.commons.ssl.util Hex encode

List of usage examples for org.apache.commons.ssl.util Hex encode

Introduction

In this page you can find the example usage for org.apache.commons.ssl.util Hex encode.

Prototype

public static String encode(byte[] b) 

Source Link

Usage

From source file:edu.internet2.middleware.shibboleth.idp.session.impl.SessionManagerImpl.java

/** {@inheritDoc} */
public Session createSession() {
    // generate a random session ID
    byte[] sid = new byte[sessionIDSize];
    prng.nextBytes(sid);//from  w  w  w .j  a v a  2 s. c o  m
    String sessionID = Hex.encode(sid);

    byte[] sessionSecret = new byte[16];
    prng.nextBytes(sessionSecret);

    Session session = new SessionImpl(sessionID, sessionSecret, sessionLifetime);
    SessionManagerEntry sessionEntry = new SessionManagerEntry(session, sessionLifetime);
    sessionStore.put(partition, sessionID, sessionEntry);

    MDC.put("idpSessionId", sessionID);
    log.trace("Created session {}", sessionID);
    return session;
}

From source file:edu.internet2.middleware.shibboleth.idp.session.impl.SessionManagerImpl.java

/** {@inheritDoc} */
public Session createSession(String principal) {
    // generate a random session ID
    byte[] sid = new byte[sessionIDSize];
    prng.nextBytes(sid);/*from  ww  w. j a  v a 2 s .  c  om*/
    String sessionID = Hex.encode(sid);

    byte[] sessionSecret = new byte[16];
    prng.nextBytes(sessionSecret);

    Session session = new SessionImpl(sessionID, sessionSecret, sessionLifetime);
    SessionManagerEntry sessionEntry = new SessionManagerEntry(session, sessionLifetime);
    sessionStore.put(partition, sessionID, sessionEntry);

    MDC.put("idpSessionId", sessionID);
    log.trace("Created session {}", sessionID);
    return session;
}