diff options
Diffstat (limited to 'auth/auth-batch/src')
3 files changed, 34 insertions, 24 deletions
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java index a985640b..c459dc66 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java @@ -3,6 +3,8 @@ * org.onap.aaf * =========================================================================== * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * + * Modifications Copyright © 2018 IBM. * =========================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,20 +32,19 @@ import java.util.Map; import java.util.Set; import org.onap.aaf.cadi.Access; -import org.onap.aaf.cadi.PropAccess; public class ExpireRange { private static final String AAF_BATCH_RANGE = "aaf_batch_range."; public Map<String,List<Range>> ranges; public final Date now; + public String rangeOneMonth = "OneMonth"; public ExpireRange(final Access access) { now = new Date(); ranges = new HashMap<>(); int i=0; String prop = access.getProperty(AAF_BATCH_RANGE + i,null); - if(prop==null) { - if(i==0) { + if(prop==null && i==0) { List<Range> lcred = getRangeList("cred"); List<Range> lur = getRangeList("ur"); List<Range> lx509 = getRangeList("x509"); @@ -55,14 +56,13 @@ public class ExpireRange { lcred.add(new Range("CredOneWeek",3,1,0,0,GregorianCalendar.WEEK_OF_MONTH,1)); lcred.add(new Range("CredTwoWeek",2,1,GregorianCalendar.WEEK_OF_MONTH,1,GregorianCalendar.WEEK_OF_MONTH,2)); - lcred.add(new Range("OneMonth",1,7,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1)); + lcred.add(new Range(rangeOneMonth,1,7,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1)); lcred.add(new Range("TwoMonth",1,0,GregorianCalendar.MONTH,1,GregorianCalendar.MONTH,2)); - lur.add(new Range("OneMonth",1,7,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1)); + lur.add(new Range(rangeOneMonth,1,7,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1)); - lx509.add(new Range("OneMonth",1,7,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1)); + lx509.add(new Range(rangeOneMonth,1,7,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1)); } - } } public Set<String> names() { diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Perm.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Perm.java index 21bd71ee..acf54274 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Perm.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Perm.java @@ -3,6 +3,8 @@ * org.onap.aaf * =========================================================================== * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * + * Modifications Copyright © 2018 IBM. * =========================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,9 +44,24 @@ public class Perm implements Comparable<Perm> { public static final TreeMap<String,Perm> keys = new TreeMap<>(); private static List<Perm> deletePerms = new ArrayList<>(); - public final String ns, type, instance, action,description; - private String fullType = null, fullPerm = null, encode = null; + public final String ns; + public final String type; + public final String instance; + public final String action; + public final String description; + private String fullType = null; + private String fullPerm = null; + private String encode = null; public final Set<String> roles; + + public Perm(String ns, String type, String instance, String action, String description, Set<String> roles) { + this.ns = ns; + this.type = type; + this.instance = instance; + this.action = action; + this.description = description; + this.roles = roles; + } public String encode() { if (encode == null) { @@ -66,17 +83,6 @@ public class Perm implements Comparable<Perm> { } return fullPerm; } - - public Perm(String ns, String type, String instance, String action, String description, Set<String> roles) { - this.ns = ns; - this.type = type; - this.instance = instance; - this.action = action; - this.description = description; - // 2.0.11 -// this.full = encode();//ns+'.'+type+'|'+instance+'|'+action; - this.roles = roles; - } public static void load(Trans trans, Session session) { load(trans, session, "select ns, type, instance, action, description, roles from authz.perm;"); diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java index 0ffaa8f5..3cbf90fa 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java @@ -3,6 +3,8 @@ * org.onap.aaf * =========================================================================== * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * + * Modifications Copyright © 2018 IBM. * =========================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +23,6 @@ package org.onap.aaf.auth.batch.helpers; -import java.io.IOException; import java.nio.ByteBuffer; import java.security.cert.X509Certificate; import java.util.Iterator; @@ -42,7 +43,10 @@ import com.datastax.driver.core.SimpleStatement; import com.datastax.driver.core.Statement; public class X509 { - public final String ca,id,x500,x509; + public final String ca; + public final String id; + public final String x500; + public final String x509; public ByteBuffer serial; public X509(String ca, String id, String x500, String x509, ByteBuffer serial) { @@ -104,12 +108,12 @@ public class X509 { } - public void row(CSV.Writer cw, X509Certificate x509Cert) throws IOException { + public void row(CSV.Writer cw, X509Certificate x509Cert) { cw.row("x509",ca,Hash.toHex(serial.array()),Chrono.dateOnlyStamp(x509Cert.getNotAfter()),x500); } - public static void row(StringBuilder sb, List<String> row) throws IOException { + public static void row(StringBuilder sb, List<String> row) { sb.append("DELETE from authz.x509 WHERE ca='"); sb.append(row.get(1)); sb.append("' AND serial="); |