use of com.orientechnologies.common.exception.OSystemException in project orientdb by orientechnologies.
the class OTokenHandlerImpl method deserializeWebPayload.
protected OJwtPayload deserializeWebPayload(final String type, final byte[] decodedPayload) {
if (!"OrientDB".equals(type)) {
throw new OSystemException("Payload class not registered:" + type);
}
final ODocument doc = new ODocument();
try {
doc.fromJSON(new String(decodedPayload, "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw OException.wrapException(new OSystemException("Payload encoding format differs from UTF-8"), e);
}
final OrientJwtPayload payload = new OrientJwtPayload();
payload.setIssuer((String) doc.field("iss"));
payload.setExpiry((Long) doc.field("exp"));
payload.setIssuedAt((Long) doc.field("iat"));
payload.setNotBefore((Long) doc.field("nbf"));
payload.setDatabase((String) doc.field("sub"));
payload.setAudience((String) doc.field("aud"));
payload.setTokenId((String) doc.field("jti"));
final int cluster = (Integer) doc.field("uidc");
final long pos = (Long) doc.field("uidp");
payload.setUserRid(new ORecordId(cluster, pos));
payload.setDatabaseType((String) doc.field("bdtyp"));
return payload;
}
use of com.orientechnologies.common.exception.OSystemException in project orientdb by orientechnologies.
the class OConsoleDatabaseApp method displayRecord.
@ConsoleCommand(aliases = { "display" }, description = "Display current record attributes", onlineHelp = "Console-Command-Display-Record")
public void displayRecord(@ConsoleParameter(name = "number", description = "The number of the record in the most recent result set") final String iRecordNumber) {
checkForDatabase();
if (iRecordNumber == null || currentResultSet == null)
checkCurrentObject();
else {
int recNumber = Integer.parseInt(iRecordNumber);
if (currentResultSet.size() == 0)
throw new OSystemException("No result set where to find the requested record. Execute a query first.");
if (currentResultSet.size() <= recNumber)
throw new OSystemException("The record requested is not part of current result set (0" + (currentResultSet.size() > 0 ? "-" + (currentResultSet.size() - 1) : "") + ")");
setCurrentRecord(recNumber);
}
dumpRecordDetails();
}
Aggregations