private CIDAO<AuthzTrans> infoDAO;
private PSInfo psNS;
private PSInfo psID;
+ private PSInfo psIDBath;
public CredDAO(AuthzTrans trans, Cluster cluster, String keyspace) throws APIException, IOException {
super(trans, CredDAO.class.getSimpleName(),cluster, keyspace, Data.class,TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
public Date expires;
public Integer other;
public String ns;
- public String tag;
- public String notes;
+ public String tag;
+ public String notes;
public ByteBuffer cred; // this is a blob in cassandra
@Override
protected void key(Data data, int _idx, Object[] obj) {
- int idx = _idx;
+ int idx = _idx;
obj[idx] = data.id;
obj[++idx] = data.type;
psID = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
" WHERE id = ?", CredLoader.deflt,readConsistency);
+
+ // NOTE: (type) in ((1),(2)) is valid for Cass 2.1.14. After 2.1.14, more obvious
+ // syntax of type in (1,2) is available
+ // ALSO, 1 & 2 STAND FOR BASIC_AUTH (MD5) AND BASIC_AUTH_SHA256(with salt).
+ // If more Basic Auth Protocols become available, add here but do NOT
+ // add X509, and there can be man Certs, and we don't need to read them every time, or
+ // as discovered, or provide CASS Outage due to too many Certs to read.
+ psIDBath = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
+ " WHERE id = ? and (type) in ((1),(2))", CredLoader.deflt,readConsistency);
}
- /* (non-Javadoc)
- * @see org.onap.aaf.auth.dao.CassDAOImpl#create(org.onap.aaf.misc.env.TransStore, java.lang.Object)
- */
- @Override
- public Result<Data> create(AuthzTrans trans, Data data) {
- if(data.tag == null) {
- if(data.type==0) {
- data.tag="PlaceHolder";
- } else {
- long l = srand.nextLong();
- data.tag = Long.toHexString(l);
- }
- }
- return super.create(trans, data);
- }
+ /* (non-Javadoc)
+ * @see org.onap.aaf.auth.dao.CassDAOImpl#create(org.onap.aaf.misc.env.TransStore, java.lang.Object)
+ */
+ @Override
+ public Result<Data> create(AuthzTrans trans, Data data) {
+ if(data.tag == null) {
+ if(data.type==0) {
+ data.tag="PlaceHolder";
+ } else {
+ long l = srand.nextLong();
+ data.tag = Long.toHexString(l);
+ }
+ }
+ return super.create(trans, data);
+ }
- public Result<List<Data>> readNS(AuthzTrans trans, String ns) {
+ public Result<List<Data>> readNS(AuthzTrans trans, String ns) {
return psNS.read(trans, R_TEXT, new Object[]{ns});
}
return psID.read(trans, R_TEXT, new Object[]{id});
}
+ public Result<List<Data>> readIDBAth(AuthzTrans trans, String id) {
+ return psIDBath.read(trans, R_TEXT, new Object[] {id});
+ }
+
/**
* Log Modification statements to History
*
: (modified.name() + "d credential for " + data.id);
String spacer = ": ";
if(data.notes!=null) {
- hd.memo+=spacer + data.notes;
- spacer = ", ";
+ hd.memo+=spacer + data.notes;
+ spacer = ", ";
}
if(data.tag!=null) {
- hd.memo+=spacer + data.tag;
+ hd.memo+=spacer + data.tag;
}
// Detail?