use of org.apache.catalina.ha.session.SerializablePrincipal in project geode by apache.
the class DeltaSession method getSerializedPrincipal.
private byte[] getSerializedPrincipal() {
if (this.serializedPrincipal == null) {
if (this.principal != null && this.principal instanceof GenericPrincipal) {
GenericPrincipal gp = (GenericPrincipal) this.principal;
SerializablePrincipal sp = SerializablePrincipal.createPrincipal(gp);
this.serializedPrincipal = serialize(sp);
if (manager != null) {
DeltaSessionManager mgr = (DeltaSessionManager) getManager();
if (mgr.getLogger().isDebugEnabled()) {
mgr.getLogger().debug(this + ": Serialized principal: " + sp);
// mgr.logCurrentStack();
}
}
}
}
return this.serializedPrincipal;
}
use of org.apache.catalina.ha.session.SerializablePrincipal in project geode by apache.
the class DeltaSession method getPrincipal.
public Principal getPrincipal() {
if (this.principal == null && this.serializedPrincipal != null) {
SerializablePrincipal sp = null;
try {
sp = (SerializablePrincipal) BlobHelper.deserializeBlob(this.serializedPrincipal);
} catch (Exception e) {
StringBuilder builder = new StringBuilder();
builder.append(this).append(": Serialized principal contains a byte[] that cannot be deserialized due to the following exception");
((DeltaSessionManager) getManager()).getLogger().warn(builder.toString(), e);
return null;
}
this.principal = sp.getPrincipal(((DeltaSessionManager) this.manager).getTheContext().getRealm());
if (getManager() != null) {
DeltaSessionManager mgr = (DeltaSessionManager) getManager();
if (mgr.getLogger().isDebugEnabled()) {
mgr.getLogger().debug(this + ": Deserialized principal: " + this.principal);
// mgr.logCurrentStack();
}
}
}
return this.principal;
}
Aggregations