summaryrefslogtreecommitdiffstats
path: root/cadi
diff options
context:
space:
mode:
Diffstat (limited to 'cadi')
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java28
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java4
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java2
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java32
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/cert/AAFListedCertIdentity.java26
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/ErrMessage.java26
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java74
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertMarshal.java6
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertsMarshal.java6
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFAuthn.java36
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFCon.java76
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFConHttp.java12
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java40
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLurPerm.java36
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java20
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTaf.java20
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTrustChecker.java2
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java48
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLur.java24
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java162
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/ArtifactDir.java30
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/CertException.java6
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Factory.java40
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifact.java4
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInFiles.java8
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java36
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactOnStream.java4
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactScripts.java22
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java22
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AAFToken.java12
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AbsOTafLur.java22
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/HRenewingTokenSS.java10
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTaf.java6
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTafResp.java12
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Lur.java12
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Principal.java12
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TimedToken.java14
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClient.java60
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java26
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenMgr.java20
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenPerm.java18
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzClient.java6
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzHClient.java8
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/obasic/OBasicHttpTaf.java32
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/olur/OLur.java16
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java46
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/PersistFile.java20
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persistable.java4
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persisting.java8
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrant.java4
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrar.java14
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java36
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java12
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java46
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/test/JU_ErrMessageTest.java38
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/JU_PermEval.java2
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/TestHClient.java10
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFAuthn.java38
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFSingleLocator.java28
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java22
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AbsAAFLocator.java2
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_ArtifactDir.java22
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CertException.java4
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInFiles.java2
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInKeystore.java2
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactOnStream.java10
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_AAFToken.java8
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Lur.java18
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Principal.java12
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java20
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenClientFactoryTest.java4
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenPerm.java2
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TzHClient.java16
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java12
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/sso/test/JU_AAFSSO.java10
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/client/sample/Sample.java52
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/content/JU_Content.java16
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java22
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java12
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java4
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java70
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java8
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java10
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java12
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java56
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java34
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java4
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java20
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java4
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java8
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java28
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java22
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java20
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java24
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java50
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java22
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java16
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java12
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java6
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java66
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java10
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java8
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java10
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java22
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java4
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java18
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java12
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java24
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java6
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java16
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java26
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java26
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java8
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java8
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java4
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java10
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/AES.java18
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java102
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Access.java32
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/BasicCred.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/BufferedServletInputStream.java40
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CachedPrincipal.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CachingLur.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CadiException.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CadiWrap.java44
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Capacitor.java44
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java36
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Connector.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CredVal.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CredValDomain.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/GetCred.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Hash.java40
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Locator.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/LocatorException.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Lur.java40
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Permission.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java70
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Revalidator.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/SecuritySetter.java14
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/ServletContextAccess.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java172
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Taf.java26
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Transmutate.java14
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/TrustChecker.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/User.java26
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/UserChain.java18
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java108
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/Get.java16
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/GetAccess.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/MultiGet.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java36
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java40
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoC.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoInit.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/UsersDump.java20
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZ.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZServlet.java10
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/AccessGetter.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiApiEnforcementFilter.java18
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java58
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiHTTPManip.java38
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java10
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java36
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapPermConverter.java10
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/PermConverter.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/RolesAllowed.java18
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/ServletImpl.java16
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/SideChain.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/lur/ConfigPrincipal.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/lur/EpiLur.java28
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalLur.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalPermission.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/lur/NullLur.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java22
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/BearerPrincipal.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/CachedBasicPrincipal.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/Kind.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/OAuth2FormPrincipal.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/TaggedPrincipal.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/TrustPrincipal.java14
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/UnAuthPrincipal.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/X509Principal.java10
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/AbsTafResp.java44
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/EpiTaf.java24
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpEpiTaf.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpTaf.java18
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/LoginPageTafResp.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTaf.java14
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTafResp.java18
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/PuntTafResp.java14
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/Redirectable.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/TafResp.java36
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustNotTafResp.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustTafResp.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTaf.java46
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTafResp.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/CertIdentity.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509HttpTafResp.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509Taf.java48
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTaf.java58
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTafResp.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java46
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/Chmod.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/FQI.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/JsonOutputStream.java10
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/MaskFormatException.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/MyConsole.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/NetMask.java16
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java74
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/SubStandardConsole.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/TheConsole.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/Timing.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/UserChainManip.java10
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/Vars.java14
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Action.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Match.java22
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/wsse/WSSEParser.java18
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XEvent.java22
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XReader.java82
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_Get.java2
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_MapBathConverter.java40
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java26
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfo.java22
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfoC.java8
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/filter/test/JU_PathFilter.java16
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_ConfigPrincipal.java12
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java12
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_CachedBasicPrincipal.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_Kind.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_OAuth2FormPrincipal.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_StringTagLookup.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TaggedPrincipal.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TrustPrincipal.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_UnAuthPrincipal.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_X509Principal.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/basic/test/JU_BasicHttpTafResp.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java2
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTafResp.java2
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java10
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java34
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_NullTaf.java20
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustNotTafResp.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustTafResp.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_AES.java8
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_BufferedCadiWrap.java2
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiException.java14
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiWrap.java52
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Capacitor.java8
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Hash.java10
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_LocatorException.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_PropAccess.java12
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_ServletContextAccess.java8
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Symm.java6
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_User.java32
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_CSV.java16
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Chmod.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_FQI.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_JsonOutputStream.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_MaskFormatException.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_NetMask.java12
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Split.java6
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_SubStandardConsole.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_TheConsole.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java20
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_WSSEParser.java20
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_XReader.java4
-rw-r--r--cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java6
-rw-r--r--cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java12
-rw-r--r--cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java56
-rw-r--r--cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java54
-rw-r--r--cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java44
-rw-r--r--cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java58
-rw-r--r--cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/MyServlet.java28
-rw-r--r--cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/Config.java8
-rw-r--r--cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyServletServer.java22
-rw-r--r--cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyStandalone.java8
-rw-r--r--cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/MiniJASPIWrap.java18
290 files changed, 2769 insertions, 2769 deletions
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java
index 8c39e44d..4a486358 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,7 +30,7 @@ import org.onap.aaf.misc.env.util.Split;
/**
* A Class that understands the AAF format of Permission (name/type/action)
* or String "name|type|action"
- *
+ *
* @author Jonathan
*
*/
@@ -38,7 +38,7 @@ public class AAFPermission implements Permission {
private static final List<String> NO_ROLES;
protected String ns,type,instance,action,key;
private List<String> roles;
-
+
static {
NO_ROLES = new ArrayList<>();
}
@@ -71,15 +71,15 @@ public class AAFPermission implements Permission {
}
this.roles = roles==null?NO_ROLES:roles;
}
-
+
/**
* Match a Permission
* if Permission is Fielded type "Permission", we use the fields
* otherwise, we split the Permission with '|'
- *
+ *
* when the type or action starts with REGEX indicator character ( ! ),
* then it is evaluated as a regular expression.
- *
+ *
* If you want a simple field comparison, it is faster without REGEX
*/
public boolean match(Permission p) {
@@ -100,7 +100,7 @@ public class AAFPermission implements Permission {
aafInstance = ap.getInstance();
aafAction = ap.getAction();
} else {
- // Permission is concatenated together: separated by
+ // Permission is concatenated together: separated by
String[] aaf = Split.splitTrim('|', p.getKey());
switch(aaf.length) {
case 1:
@@ -116,13 +116,13 @@ public class AAFPermission implements Permission {
case 3:
aafNS = aaf[0];
aafType = aaf[1];
- aafInstance = aaf[2];
+ aafInstance = aaf[2];
aafAction = "*";
break;
default:
aafNS = aaf[0];
aafType = aaf[1];
- aafInstance = aaf[2];
+ aafInstance = aaf[2];
aafAction = aaf[3];
break;
}
@@ -157,15 +157,15 @@ public class AAFPermission implements Permission {
public String getFullType() {
return ns + '.' + type;
}
-
+
public String getInstance() {
return instance;
}
-
+
public String getAction() {
return action;
}
-
+
public String getKey() {
return key;
}
@@ -183,7 +183,7 @@ public class AAFPermission implements Permission {
public String toString() {
return "AAFPermission:" +
"\n\tNS: " + ns +
- "\n\tType: " + type +
+ "\n\tType: " + type +
"\n\tInstance: " + instance +
"\n\tAction: " + action +
"\n\tKey: " + key;
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java
index c631cb9c..ab525af3 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java
index 498f1bf9..5b092740 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java
@@ -68,7 +68,7 @@ public class PermEval {
String[] pkeys=Split.split(startChar,pInst);
if (pkeys.length<skeys.length) {
return false;
- } else if(pkeys.length > skeys.length &&
+ } else if(pkeys.length > skeys.length &&
(skeys.length==0 || !ASTERIX.equals(skeys[skeys.length-1]))) {
return false;
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
index 2f2d2ac3..0b1238ab 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -53,7 +53,7 @@ import org.onap.aaf.cadi.util.FixURIinfo;
import org.onap.aaf.misc.env.APIException;
public class TestConnectivity {
-
+
private static Map<String, String> aaf_urls;
@@ -72,7 +72,7 @@ public class TestConnectivity {
try {
SecurityInfoC<HttpURLConnection> si = SecurityInfoC.instance(access, HttpURLConnection.class);
aaf_urls = Agent.loadURLs(access);
-
+
List<SecuritySetter<HttpURLConnection>> lss = loadSetters(access,si);
/////////
String directAAFURL = aaf_urls.get(Config.AAF_URL);
@@ -80,14 +80,14 @@ public class TestConnectivity {
print(true,"Test Connections by non-located aaf_url");
Locator<URI> locator = new SingleEndpointLocator(directAAFURL);
connectTest(locator,new URI(directAAFURL));
-
+
SecuritySetter<HttpURLConnection> ss = si.defSS;
permTest(locator,ss);
} else {
/////////
print(true,"Test Connections driven by AAFLocator");
String serviceURI = aaf_urls.get(Config.AAF_URL);
-
+
for (String url : new String[] {
serviceURI,
aaf_urls.get(Config.AAF_OAUTH2_TOKEN_URL),
@@ -127,7 +127,7 @@ public class TestConnectivity {
System.out.println("No User/Password to test");
}
}
-
+
} catch (Exception e) {
e.printStackTrace(System.err);
} finally {
@@ -135,14 +135,14 @@ public class TestConnectivity {
}
}
}
-
+
private static List<SecuritySetter<HttpURLConnection>> loadSetters(PropAccess access, SecurityInfoC<HttpURLConnection> si) {
print(true,"Load Security Setters from Configuration Information");
String user = access.getProperty(Config.AAF_APPID);
ArrayList<SecuritySetter<HttpURLConnection>> lss = new ArrayList<>();
-
+
try {
HBasicAuthSS hbass = new HBasicAuthSS(si,true);
@@ -177,7 +177,7 @@ public class TestConnectivity {
} catch (Exception e) {
access.log(Level.INFO, "AAF OAUTH2 Security Setter constructor threw exception: \"",e.getMessage(),"\". AAF OAUTH2 tests will not be conducted... Continuing");
}
-
+
tokenURL = access.getProperty(Config.AAF_ALT_OAUTH2_TOKEN_URL);
if (tokenURL==null) {
access.log(Level.INFO, "AAF Alternative OAUTH2 requires",Config.AAF_ALT_OAUTH2_TOKEN_URL, "OAuth2 tests to", tokenURL, "will not be conducted... Continuing");
@@ -190,7 +190,7 @@ public class TestConnectivity {
access.log(Level.INFO, "ALT OAUTH2 Security Setter constructor threw exception: \"",e.getMessage(),"\". ALT OAuth2 tests to", tokenURL, " will not be conducted... Continuing");
}
}
-
+
return lss;
}
@@ -270,11 +270,11 @@ public class TestConnectivity {
String pathInfo = "/authz/perms/user/"+user;
client.setPathInfo(pathInfo);
System.out.println(pathInfo);
-
+
client.send();
Future<String> future = client.futureReadString();
if (future.get(7000)) {
- System.out.println(future.body());
+ System.out.println(future.body());
} else {
if (future.code()==401 && ss instanceof HX509SS) {
System.out.println(" Authentication denied with 401 for Certificate.\n\t"
@@ -298,11 +298,11 @@ public class TestConnectivity {
client.setPathInfo("/authn/basicAuth");
client.addHeader("Accept", "text/plain");
client.send();
-
-
+
+
Future<String> future = client.futureReadString();
if (future.get(7000)) {
- System.out.println("BasicAuth Validated");
+ System.out.println("BasicAuth Validated");
} else {
System.out.println("Failure " + future.code() + ":" + future.body());
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/cert/AAFListedCertIdentity.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/cert/AAFListedCertIdentity.java
index c23e9b23..f3a45e5e 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/cert/AAFListedCertIdentity.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/cert/AAFListedCertIdentity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -55,16 +55,16 @@ import aaf.v2_0.Users;
import aaf.v2_0.Users.User;
public class AAFListedCertIdentity implements CertIdentity {
- //TODO should 8 hours be configurable?
- private static final long EIGHT_HOURS = 1000*60*60*8L;
-
+ //TODO should 8 hours be configurable?
+ private static final long EIGHT_HOURS = 1000*60*60*8L;
+
private static Map<ByteArrayHolder,String> certs = null;
-
+
// Did this to add other Trust Mechanisms
- // Trust mechanism set by Property:
+ // Trust mechanism set by Property:
private static final String[] authMechanisms = new String[] {"tguard","basicAuth","csp"};
private static String[] certIDs;
-
+
private static Map<String,Set<String>> trusted =null;
public AAFListedCertIdentity(Access access, AAFCon<?> aafcon) throws APIException {
@@ -86,7 +86,7 @@ public class AAFListedCertIdentity implements CertIdentity {
public static Set<String> trusted(String authMech) {
return trusted.get(authMech);
}
-
+
public TaggedPrincipal identity(HttpServletRequest req, X509Certificate cert, byte[] certBytes) throws CertificateException {
if (cert==null && certBytes==null)return null;
if (certBytes==null)certBytes = cert.getEncoded();
@@ -107,14 +107,14 @@ public class AAFListedCertIdentity implements CertIdentity {
return Hash.compareTo(ba, b.ba);
}
}
-
+
private class CertUpdate extends TimerTask {
private AAFCon<?> aafcon;
public CertUpdate(AAFCon<?> con) {
aafcon = con;
}
-
+
@Override
public void run() {
try {
@@ -142,9 +142,9 @@ public class AAFListedCertIdentity implements CertIdentity {
} else {
aafcon.access.log(Level.WARN, "Could not get Users in Perm com.att.trust|tguard|authenticate",fusr.code(),fusr.body());
}
-
+
}
-
+
for (String u : userLookup) {
Future<Certs> fc = aafcon.client().read("/authn/cert/id/"+u, Certs.class, aafcon.certsDF);
XMLGregorianCalendar now = Chrono.timeStamp();
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/ErrMessage.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/ErrMessage.java
index d5a2e58a..2d03e6ac 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/ErrMessage.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/ErrMessage.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,16 +34,16 @@ import aaf.v2_0.Error;
public class ErrMessage {
private RosettaDF<Error> errDF;
-
+
public ErrMessage(RosettaEnv env) throws APIException {
errDF = env.newDataFactory(Error.class);
}
/**
* AT&T Requires a specific Error Format for RESTful Services, which AAF complies with.
- *
- * This code will create a meaningful string from this format.
- *
+ *
+ * This code will create a meaningful string from this format.
+ *
* @param ps
* @param df
* @param r
@@ -54,12 +54,12 @@ public class ErrMessage {
Error err = errDF.newData().in(TYPE.JSON).load(attErrJson).asObject();
ps.println(toMsg(sb,err));
}
-
+
/**
* AT&T Requires a specific Error Format for RESTful Services, which AAF complies with.
- *
- * This code will create a meaningful string from this format.
- *
+ *
+ * This code will create a meaningful string from this format.
+ *
* @param sb
* @param df
* @param r
@@ -68,11 +68,11 @@ public class ErrMessage {
public StringBuilder toMsg(StringBuilder sb, String attErrJson) throws APIException {
return toMsg(sb,errDF.newData().in(TYPE.JSON).load(attErrJson).asObject());
}
-
+
public StringBuilder toMsg(Future<?> future) {
return toMsg(new StringBuilder(),future);
}
-
+
public StringBuilder toMsg(StringBuilder sb, Future<?> future) {
try {
toMsg(sb,errDF.newData().in(TYPE.JSON).load(future.body()).asObject());
@@ -93,7 +93,7 @@ public class ErrMessage {
Vars.convert(sb, err.getText(),vars);
return sb;
}
-
+
public Error getError(Future<?> future) throws APIException {
return errDF.newData().in(TYPE.JSON).load(future.body()).asObject();
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java
index 921b5096..65202940 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -85,12 +85,12 @@ public class Examples {
} else {
className = nameOrContentType;
}
-
+
// No Void.class in aaf.v2_0 package causing errors when trying to use a newVoidv2_0
// method similar to others in this class. This makes it work, but is it right?
if ("Void".equals(className))
return "";
-
+
if ("1.1".equals(version)) {
version = "v1_0";
} else if (version!=null) {
@@ -98,7 +98,7 @@ public class Examples {
} else {
version = "v2_0";
}
-
+
Class<?> cls=null;
int minorIdx = version.indexOf('_');
if(minorIdx<0) {
@@ -115,29 +115,29 @@ public class Examples {
}
}
}
-
+
if(cls==null) {
throw new APIException("ERROR: " + "aaf."+vprefix+"X not found.");
}
-
+
Method meth;
try {
meth = Examples.class.getDeclaredMethod("new"+cls.getSimpleName()+vprefix+minor,boolean.class);
} catch (Exception e) {
throw new APIException("ERROR: " + cls.getName() + " does not have an Example in Code. Request from AAF Developers");
}
-
+
RosettaDF<C> df = env.newDataFactory(cls);
df.option(Data.PRETTY);
-
+
Object data = meth.invoke(null,optional);
-
+
@SuppressWarnings("unchecked")
String rv = df.newData().load((C)data).out(type).asString();
// Object obj = df.newData().in(type).load(rv).asObject();
return rv;
}
-
+
/*
* Set Base Class Request (easier than coding over and over)
*/
@@ -147,9 +147,9 @@ public class Examples {
gc.add(GregorianCalendar.MONTH, 6);
req.setEnd(Chrono.timeStamp(gc));
// req.setForce("false");
-
+
}
-
+
@SuppressWarnings("unused")
private static Request newRequestv2_0(boolean optional) {
Request r = new Request();
@@ -168,7 +168,7 @@ public class Examples {
if (optional)setOptional(rpr);
return rpr;
}
-
+
@SuppressWarnings("unused")
private static Roles newRolesv2_0(boolean optional) {
Role r;
@@ -206,8 +206,8 @@ public class Examples {
return rs;
}
-
-
+
+
@SuppressWarnings("unused")
private static PermRequest newPermRequestv2_0(boolean optional) {
PermRequest pr = new PermRequest();
@@ -216,12 +216,12 @@ public class Examples {
pr.setAction("myAction");
if (optional) {
pr.setDescription("Short and meaningful verbiage about the Permission");
-
+
setOptional(pr);
}
return pr;
}
-
+
@SuppressWarnings("unused")
private static Perm newPermv2_0(boolean optional) {
Perm pr = new Perm();
@@ -246,7 +246,7 @@ public class Examples {
pr.setAction("myAction");
return pr;
}
-
+
@SuppressWarnings("unused")
private static Perms newPermsv2_0(boolean optional) {
Perms perms = new Perms();
@@ -268,9 +268,9 @@ public class Examples {
p.getRoles().add("org.osaaf.myns.myRole2");
return perms;
-
+
}
-
+
@SuppressWarnings("unused")
private static UserRoleRequest newUserRoleRequestv2_0(boolean optional) {
UserRoleRequest urr = new UserRoleRequest();
@@ -279,7 +279,7 @@ public class Examples {
if (optional) setOptional(urr);
return urr;
}
-
+
@SuppressWarnings("unused")
private static NsRequest newNsRequestv2_0(boolean optional) {
NsRequest nr = new NsRequest();
@@ -287,7 +287,7 @@ public class Examples {
nr.getResponsible().add("ab1234@people.osaaf.org");
nr.getResponsible().add("cd5678@people.osaaf.org");
nr.getAdmin().add("zy9876@people.osaaf.org");
- nr.getAdmin().add("xw5432@people.osaaf.org");
+ nr.getAdmin().add("xw5432@people.osaaf.org");
if (optional) {
nr.setDescription("This is my Namespace to set up");
nr.setType("APP");
@@ -295,12 +295,12 @@ public class Examples {
}
return nr;
}
-
-
+
+
@SuppressWarnings("unused")
private static Nss newNssv2_0(boolean optional) {
Ns ns;
-
+
Nss nss = new Nss();
nss.getNs().add(ns = new Nss.Ns());
ns.setName("org.osaaf.myns");
@@ -309,14 +309,14 @@ public class Examples {
ns.getAdmin().add("zy9876@people.osaaf.org");
ns.getAdmin().add("xw5432@people.osaaf.org");
ns.setDescription("This is my Namespace to set up");
-
+
nss.getNs().add(ns = new Nss.Ns());
ns.setName("org.osaaf.myOtherNs");
ns.getResponsible().add("ab1234@people.osaaf.org");
ns.getResponsible().add("cd5678@people.osaaf.org");
ns.getAdmin().add("zy9876@people.osaaf.org");
- ns.getAdmin().add("xw5432@people.osaaf.org");
-
+ ns.getAdmin().add("xw5432@people.osaaf.org");
+
return nss;
}
@SuppressWarnings("unused")
@@ -343,23 +343,23 @@ public class Examples {
return cr;
}
-
+
@SuppressWarnings("unused")
private static Users newUsersv2_0(boolean optional) {
User user;
-
+
Users users = new Users();
user = new Users.User();
users.getUser().add(user);
- user.setId("ab1234@people.osaaf.org");
+ user.setId("ab1234@people.osaaf.org");
GregorianCalendar gc = new GregorianCalendar();
user.setExpires(Chrono.timeStamp(gc));
user = new Users.User();
users.getUser().add(user);
- user.setId("zy9876@people.osaaf.org");
- user.setExpires(Chrono.timeStamp(gc));
-
+ user.setId("zy9876@people.osaaf.org");
+ user.setExpires(Chrono.timeStamp(gc));
+
return users;
}
@@ -400,7 +400,7 @@ public class Examples {
ur.setRole("com.test.myapp.myRole");
ur.setExpires(Chrono.timeStamp());
urs.getUserRole().add(ur);
-
+
ur = new UserRole();
ur.setUser("yx4321");
ur.setRole("com.test.yourapp.yourRole");
@@ -453,7 +453,7 @@ public class Examples {
return a;
}
-
+
@SuppressWarnings("unused")
private static aaf.v2_0.Error newErrorv2_0(boolean optional) {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertMarshal.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertMarshal.java
index eb116490..ab95a5a7 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertMarshal.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertMarshal.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,7 +52,7 @@ public class CertMarshal extends ObjMarshal<Cert> {
return t.getX500();
}
});
-
+
add(new FieldDateTime<Cert>("expires") {
@Override
protected XMLGregorianCalendar data(Cert t) {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertsMarshal.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertsMarshal.java
index 93530793..a69b0a39 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertsMarshal.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertsMarshal.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@ public class CertsMarshal extends ObjMarshal<Certs> {
protected List<Cert> data(Certs t) {
return t.getCert();
}
- });
+ });
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFAuthn.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFAuthn.java
index 216468c2..c48e35f4 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFAuthn.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFAuthn.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,7 +36,7 @@ import aaf.v2_0.CredRequest;
public class AAFAuthn<CLIENT> extends AbsUserCache<AAFPermission> {
private AAFCon<CLIENT> con;
private String realm;
-
+
/**
* Configure with Standard AAF properties, Stand alone
* @param con
@@ -51,17 +51,17 @@ public class AAFAuthn<CLIENT> extends AbsUserCache<AAFPermission> {
/**
* Configure with Standard AAF properties, but share the Cache (with AAF Lur)
* @param con
- * @throws Exception
+ * @throws Exception
*/
// Package on purpose
AAFAuthn(AAFCon<CLIENT> con, AbsUserCache<AAFPermission> cache) {
super(cache);
this.con = con;
}
-
+
/**
* Return Native Realm of AAF Instance.
- *
+ *
* @return
*/
public String getRealm() {
@@ -70,24 +70,24 @@ public class AAFAuthn<CLIENT> extends AbsUserCache<AAFPermission> {
/**
* Returns null if ok, or an Error String;
- *
+ *
* Convenience function. Passes "null" for State object
*/
public String validate(String user, String password) throws IOException {
return validate(user,password,null);
}
-
+
/**
* Returns null if ok, or an Error String;
- *
+ *
* For State Object, you may put in HTTPServletRequest or AuthzTrans, if available. Otherwise,
* leave null
- *
+ *
* @param user
* @param password
* @return
- * @throws IOException
- * @throws CadiException
+ * @throws IOException
+ * @throws CadiException
* @throws Exception
*/
public String validate(String user, String password, Object state) throws IOException {
@@ -121,11 +121,11 @@ public class AAFAuthn<CLIENT> extends AbsUserCache<AAFPermission> {
return "user/pass combo invalid for " + user;
case DENIED:
return "AAF denies API for " + user;
- default:
+ default:
return "AAFAuthn doesn't handle Principal " + user;
}
}
-
+
private class AAFCachedPrincipal extends ConfigPrincipal implements CachedPrincipal {
private long expires;
private long timeToLive;
@@ -140,10 +140,10 @@ public class AAFAuthn<CLIENT> extends AbsUserCache<AAFPermission> {
try {
Miss missed = missed(getName(),getCred());
if (missed==null || missed.mayContinue()) {
- CredRequest cr = new CredRequest();
- cr.setId(getName());
- cr.setPassword(new String(getCred()));
- Future<String> fp = con.client().readPost("/authn/validate", con.credReqDF, cr);
+ CredRequest cr = new CredRequest();
+ cr.setId(getName());
+ cr.setPassword(new String(getCred()));
+ Future<String> fp = con.client().readPost("/authn/validate", con.credReqDF, cr);
//Rcli<CLIENT> client = con.client().forUser(con.basicAuth(getName(), new String(getCred())));
//Future<String> fp = client.read(
// "/authn/basicAuth",
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFCon.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFCon.java
index 3b97883b..7c315e1a 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFCon.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFCon.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -134,12 +134,12 @@ public abstract class AAFCon<CLIENT> implements Connector {
si.defSS=x509Alias(alias);
set(si.defSS);
} else {
-
+
String encpass = access.getProperty(Config.AAF_APPPASS, null);
if (encpass==null) {
encpass = access.getProperty(Config.OAUTH_CLIENT_SECRET,null);
}
-
+
if (encpass==null) {
if (alias==null) {
access.printf(Access.Level.WARN,"%s, %s or %s required before use.", Config.CADI_ALIAS, Config.AAF_APPID, Config.OAUTH_CLIENT_ID);
@@ -151,17 +151,17 @@ public abstract class AAFCon<CLIENT> implements Connector {
set(si.defSS);
} else {
si.defSS=new SecuritySetter<CLIENT>() {
-
+
@Override
public String getID() {
return "";
}
-
+
@Override
public void setSecurity(CLIENT client) throws CadiException {
throw new CadiException("AAFCon has not been initialized with Credentials (SecuritySetter)");
}
-
+
@Override
public int setLastResponse(int respCode) {
return 0;
@@ -172,18 +172,18 @@ public abstract class AAFCon<CLIENT> implements Connector {
}
}
}
-
+
timeout = Integer.parseInt(access.getProperty(Config.AAF_CALL_TIMEOUT, Config.AAF_CALL_TIMEOUT_DEF));
cleanInterval = Integer.parseInt(access.getProperty(Config.AAF_CLEAN_INTERVAL, Config.AAF_CLEAN_INTERVAL_DEF));
highCount = Integer.parseInt(access.getProperty(Config.AAF_HIGH_COUNT, Config.AAF_HIGH_COUNT_DEF).trim());
connTimeout = Integer.parseInt(access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF).trim());
userExpires = Integer.parseInt(access.getProperty(Config.AAF_USER_EXPIRES, Config.AAF_USER_EXPIRES_DEF).trim());
usageRefreshTriggerCount = Integer.parseInt(access.getProperty(Config.AAF_USER_EXPIRES, Config.AAF_USER_EXPIRES_DEF).trim())-1; // zero based
-
+
app=FQI.reverseDomain(si.defSS.getID());
//TODO Get Realm from AAF
realm="people.osaaf.org";
-
+
env = new RosettaEnv();
permsDF = env.newDataFactory(Perms.class);
usersDF = env.newDataFactory(Users.class);
@@ -201,22 +201,22 @@ public abstract class AAFCon<CLIENT> implements Connector {
public final String aafVersion() {
return apiVersion;
}
-
+
/**
* Use this call to get the appropriate client based on configuration (HTTP, future)
* using default AAF API Version
- *
+ *
* @param apiVersion
* @return
* @throws CadiException
*/
public Rcli<CLIENT> client() throws CadiException {
return client(apiVersion);
- }
+ }
/**
* Use this call to get the appropriate client based on configuration (HTTP, future)
- *
+ *
* @param apiVersion
* @return
* @throws CadiException
@@ -228,19 +228,19 @@ public abstract class AAFCon<CLIENT> implements Connector {
client.apiVersion(apiVersion)
.readTimeout(connTimeout);
clients.put(apiVersion, client);
- }
+ }
return client;
}
public Rcli<CLIENT> client(URI uri) throws CadiException {
return rclient(uri,si.defSS).readTimeout(connTimeout);
}
-
+
/**
* Use this API when you have permission to have your call act as the end client's ID.
- *
+ *
* Your calls will get 403 errors if you do not have this permission. it is a special setup, rarely given.
- *
+ *
* @param apiVersion
* @param req
* @return
@@ -249,12 +249,12 @@ public abstract class AAFCon<CLIENT> implements Connector {
public Rcli<CLIENT> clientAs(TaggedPrincipal p) throws CadiException {
return clientAs(apiVersion,p);
}
-
+
/**
* Use this API when you have permission to have your call act as the end client's ID.
- *
+ *
* Your calls will get 403 errors if you do not have this permission. it is a special setup, rarely given.
- *
+ *
* @param apiVersion
* @param req
* @return
@@ -265,14 +265,14 @@ public abstract class AAFCon<CLIENT> implements Connector {
return cl.forUser(transferSS(p));
}
-
+
public RosettaEnv env() {
return env;
}
-
+
/**
* Return the backing AAFCon, if there is a Lur Setup that is AAF.
- *
+ *
* If there is no AAFLur setup, it will return "null"
* @param servletRequest
* @return
@@ -295,9 +295,9 @@ public abstract class AAFCon<CLIENT> implements Connector {
}
return null;
}
-
+
public abstract AAFCon<CLIENT> clone(String url) throws CadiException, LocatorException;
-
+
public AAFAuthn<CLIENT> newAuthn() throws APIException {
try {
return new AAFAuthn<>(this);
@@ -324,7 +324,7 @@ public abstract class AAFCon<CLIENT> implements Connector {
throw new CadiException(e);
}
}
-
+
public AAFLurPerm newLur(AbsUserCache<AAFPermission> c) throws APIException {
try {
return new AAFLurPerm(this,c);
@@ -336,33 +336,33 @@ public abstract class AAFCon<CLIENT> implements Connector {
}
protected abstract Rcli<CLIENT> rclient(URI uri, SecuritySetter<CLIENT> ss) throws CadiException;
-
+
public abstract Rcli<CLIENT> rclient(Locator<URI> loc, SecuritySetter<CLIENT> ss) throws CadiException;
public Rcli<CLIENT> client(Locator<URI> locator) throws CadiException {
return rclient(locator,si.defSS);
}
-
+
public abstract<RET> RET best(Retryable<RET> retryable) throws LocatorException, CadiException, APIException;
public abstract<RET> RET bestForUser(GetSetter get, Retryable<RET> retryable) throws LocatorException, CadiException, APIException;
public abstract SecuritySetter<CLIENT> basicAuth(String user, String password) throws CadiException;
-
+
public abstract SecuritySetter<CLIENT> transferSS(TaggedPrincipal principal) throws CadiException;
-
+
public abstract SecuritySetter<CLIENT> basicAuthSS(BasicPrincipal principal) throws CadiException;
-
+
public abstract SecuritySetter<CLIENT> tokenSS(final String client_id, final String accessToken) throws CadiException;
-
+
public abstract SecuritySetter<CLIENT> x509Alias(String alias) throws APIException, CadiException;
-
+
public String getRealm() {
return realm;
}
-
+
/**
* This interface allows the AAFCon, even though generic, to pass in correctly typed values based on the above SS commands.
* @author Jonathan
@@ -379,7 +379,7 @@ public abstract class AAFCon<CLIENT> implements Connector {
}
return ss;
}
-
+
public SecurityInfoC<CLIENT> securityInfo() {
return si;
}
@@ -390,7 +390,7 @@ public abstract class AAFCon<CLIENT> implements Connector {
}
return "unknown";
}
-
+
public void invalidate() throws CadiException {
for (Rcli<CLIENT> client : clients.values()) {
client.invalidate();
@@ -412,7 +412,7 @@ public abstract class AAFCon<CLIENT> implements Connector {
}
return text;
}
-
+
public static AAFCon<?> newInstance(PropAccess pa) throws CadiException, LocatorException {
// Potentially add plugin for other kinds of Access
return new AAFConHttp(pa);
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFConHttp.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFConHttp.java
index e60b5d8a..b62bc404 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFConHttp.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFConHttp.java
@@ -7,9 +7,9 @@ r * ============LICENSE_START===================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -82,7 +82,7 @@ public class AAFConHttp extends AAFCon<HttpURLConnection> {
super(access,tag,si);
hman = new HMangr(access, locator);
}
-
+
private AAFConHttp(AAFCon<HttpURLConnection> aafcon, String url) throws LocatorException {
super(aafcon);
si=aafcon.si;
@@ -127,7 +127,7 @@ public class AAFConHttp extends AAFCon<HttpURLConnection> {
@Override
protected Rcli<HttpURLConnection> rclient(URI ignoredURI, SecuritySetter<HttpURLConnection> ss) throws CadiException {
if (hman.loc==null) {
- throw new CadiException("No Locator set in AAFConHttp");
+ throw new CadiException("No Locator set in AAFConHttp");
}
try {
return new HRcli(hman, hman.loc.best() ,ss);
@@ -135,7 +135,7 @@ public class AAFConHttp extends AAFCon<HttpURLConnection> {
throw new CadiException(e);
}
}
-
+
@Override
public Rcli<HttpURLConnection> rclient(Locator<URI> loc, SecuritySetter<HttpURLConnection> ss) throws CadiException {
try {
@@ -149,7 +149,7 @@ public class AAFConHttp extends AAFCon<HttpURLConnection> {
public AbsTransferSS<HttpURLConnection> transferSS(TaggedPrincipal principal) {
return new HTransferSS(principal, app,si);
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.cadi.aaf.v2_0.AAFCon#basicAuthSS(java.security.Principal)
*/
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java
index 38f6bcea..3611e481 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -67,7 +67,7 @@ public class AAFLocator extends AbsAAFLocator<BasicTrans> {
env = new RosettaEnv(access.getProperties());
}
}
-
+
int connectTimeout = Integer.parseInt(si.access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF));
try {
String[] path = Split.split('/',locatorURI.getPath());
@@ -86,32 +86,32 @@ public class AAFLocator extends AbsAAFLocator<BasicTrans> {
client = new HClient(si.defSS, locatorURI, connectTimeout);
}
epsDF = env.newDataFactory(Endpoints.class);
-
+
} catch (APIException /*| URISyntaxException*/ e) {
throw new LocatorException(e);
}
lclient = new HClient(si.defSS, locatorURI, connectTimeout);
-
+
if(si.access.willLog(Access.Level.DEBUG)) {
si.access.log(Access.Level.DEBUG, "Root URI:",client.getURI());
}
-
+
String dnsString;
if(locatorURI.getPort()<0) {
- dnsString=locatorURI.getScheme() + "://" + locatorURI.getHost();
+ dnsString=locatorURI.getScheme() + "://" + locatorURI.getHost();
} else {
- dnsString=locatorURI.getScheme() + "://" +locatorURI.getHost()+':'+locatorURI.getPort();
+ dnsString=locatorURI.getScheme() + "://" +locatorURI.getHost()+':'+locatorURI.getPort();
}
if(dnsString.contains("null")) { // for Testing Purposes, mostly.
- locatorLocator = null;
+ locatorLocator = null;
} else {
- locatorLocator = new DNSLocator(access, dnsString);
- if(locatorLocator.hasItems()) {
- locatorItem = locatorLocator.best();
- } else {
- // For when DNS doesn't work, including some K8s Installations
- locatorLocator = new SingleEndpointLocator(dnsString);
- }
+ locatorLocator = new DNSLocator(access, dnsString);
+ if(locatorLocator.hasItems()) {
+ locatorItem = locatorLocator.best();
+ } else {
+ // For when DNS doesn't work, including some K8s Installations
+ locatorLocator = new SingleEndpointLocator(dnsString);
+ }
}
}
@@ -129,7 +129,7 @@ public class AAFLocator extends AbsAAFLocator<BasicTrans> {
}
protected final int maxIters() {
-
+
return locatorLocator.size();
}
@@ -166,7 +166,7 @@ public class AAFLocator extends AbsAAFLocator<BasicTrans> {
for (Endpoint endpoint : fr.value.getEndpoint()) {
epl.add(new EP(endpoint,latitude,longitude));
}
-
+
Collections.sort(epl);
replace(epl);
return true;
@@ -186,9 +186,9 @@ public class AAFLocator extends AbsAAFLocator<BasicTrans> {
protected URI getURI() {
return client.getURI();
}
-
+
protected HClient createClient(SecuritySetter<HttpURLConnection> ss, URI uri, int connectTimeout) throws LocatorException {
return new HClient(ss, uri, connectTimeout);
}
-
+
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLurPerm.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLurPerm.java
index 9f537bd9..caa1fcc1 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLurPerm.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLurPerm.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,11 +52,11 @@ import aaf.v2_0.Perms;
/**
* Use AAF Service as Permission Service.
- *
+ *
* This Lur goes after AAF Permissions, which are elements of Roles, not the Roles themselves.
- *
+ *
* If you want a simple Role Lur, use AAFRoleLur
- *
+ *
* @author Jonathan
*
*/
@@ -65,13 +65,13 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
/**
* Need to be able to transmutate a Principal into either Person or AppID, which are the only ones accepted at this
- * point by AAF. There is no "domain", aka, no "@att.com" in "ab1234@att.com".
- *
+ * point by AAF. There is no "domain", aka, no "@att.com" in "ab1234@att.com".
+ *
* The only thing that matters here for AAF is that we don't waste calls with IDs that obviously aren't valid.
* Thus, we validate that the ID portion follows the rules before we waste time accessing AAF remotely
- * @throws APIException
- * @throws URISyntaxException
- * @throws DME2Exception
+ * @throws APIException
+ * @throws URISyntaxException
+ * @throws DME2Exception
*/
// Package on purpose
AAFLurPerm(AAFCon<?> con) throws CadiException, APIException {
@@ -84,7 +84,7 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
super(con,auc);
attachOAuth2(con);
}
-
+
private void attachOAuth2(AAFCon<?> con) throws APIException {
String oauth2_url;
Class<?> tmcls = Config.loadClass(access,"org.osaaf.cadi.oauth.TokenMgr");
@@ -113,7 +113,7 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
final Holder<Float> remote = new Holder<Float>(0f);
final boolean[] success = new boolean[]{false};
-
+
try {
return aaf.best(new Retryable<User<AAFPermission>>() {
@Override
@@ -125,7 +125,7 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
sb.append("?force");
}
Future<Perms> fp = client.read(sb.toString(),aaf.permsDF);
-
+
// In the meantime, lookup User, create if necessary
User<AAFPermission> user = getUser(principal);
Principal p;
@@ -139,11 +139,11 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
} else {
p = principal;
}
-
+
if (user==null) {
addUser(user = new User<AAFPermission>(p,aaf.userExpires)); // no password
}
-
+
// OK, done all we can, now get content
boolean ok = fp.get(aaf.timeout);
remote.set(Timing.millis(remoteStart));
@@ -199,13 +199,13 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
"/authz/perms/user/"+name,
aaf.permsDF
);
-
+
// OK, done all we can, now get content
boolean ok = fp.get(aaf.timeout);
remote.set(Timing.millis(remoteStart));
if (ok) {
success.set(true);
- Map<String,Permission> newMap = user.newMap();
+ Map<String,Permission> newMap = user.newMap();
boolean willLog = aaf.access.willLog(Level.DEBUG);
for (Perm perm : fp.value.getPerm()) {
user.add(newMap, new AAFPermission(perm.getNs(),perm.getType(),perm.getInstance(),perm.getAction(),perm.getRoles()));
@@ -258,5 +258,5 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
return new LocalPermission(p);
}
}
-
+
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java
index 8f4fff67..314d5c1c 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,15 +28,15 @@ import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
/**
- * This Locator good for using Inside Docker or K8s, where there is no real lookup,
- * and there is conflict between external and internal host names, due to
+ * This Locator good for using Inside Docker or K8s, where there is no real lookup,
+ * and there is conflict between external and internal host names, due to
* Service abstraction.
- *
+ *
* @author Instrumental(Jonathan)
*
*/
public class AAFSingleLocator implements Locator<URI> {
-
+
private final URI uri;
/**
@@ -44,12 +44,12 @@ public class AAFSingleLocator implements Locator<URI> {
* @param cont_ns
* @param prefix
* @param version
- * @throws URISyntaxException
+ * @throws URISyntaxException
*/
public AAFSingleLocator(final String uri) throws URISyntaxException {
this.uri = new URI(uri);
}
-
+
@Override
public URI get(Item item) throws LocatorException {
return uri;
@@ -87,10 +87,10 @@ public class AAFSingleLocator implements Locator<URI> {
@Override
public void destroy() {
}
-
+
private class SingleItem implements Item {
}
-
+
public static AAFSingleLocator create(Access access, String url) throws URISyntaxException {
return new AAFSingleLocator(url);
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTaf.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTaf.java
index 81b55507..c7744407 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTaf.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTaf.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -58,7 +58,7 @@ public class AAFTaf<CLIENT> extends AbsUserCache<AAFPermission> implements HttpT
private AAFCon<CLIENT> aaf;
private boolean warn;
private MapBathConverter mapIds;
-
+
public AAFTaf(AAFCon<CLIENT> con, boolean turnOnWarning) {
super(con.access,con.cleanInterval,con.highCount, con.usageRefreshTriggerCount);
aaf = con;
@@ -73,7 +73,7 @@ public class AAFTaf<CLIENT> extends AbsUserCache<AAFPermission> implements HttpT
initMapBathConverter();
}
-
+
// Note: Needed for Creation of this Object with Generics
@SuppressWarnings("unchecked")
public AAFTaf(Connector mustBeAAFCon, boolean turnOnWarning, AbsUserCache<AAFPermission> other) {
@@ -133,10 +133,10 @@ public class AAFTaf<CLIENT> extends AbsUserCache<AAFPermission> implements HttpT
Miss miss = missed(bp.getName(), bp.getCred());
if (miss!=null && !miss.mayContinue()) {
return new BasicHttpTafResp(aaf.access,bp.getName(),buildMsg(bp,req,
- "User/Pass Retry limit exceeded"),
+ "User/Pass Retry limit exceeded"),
RESP.TRY_AUTHENTICATING,resp,aaf.getRealm(),true);
}
-
+
return aaf.bestForUser(
new GetSetter() {
@Override
@@ -159,11 +159,11 @@ public class AAFTaf<CLIENT> extends AbsUserCache<AAFPermission> implements HttpT
boolean rv= addMiss(bp.getName(),bp.getCred());
if (rv) {
return new BasicHttpTafResp(aaf.access,bp.getName(),buildMsg(bp,req,
- "user/pass combo invalid via AAF from " + req.getRemoteAddr()),
+ "user/pass combo invalid via AAF from " + req.getRemoteAddr()),
RESP.TRY_AUTHENTICATING,resp,aaf.getRealm(),true);
} else {
return new BasicHttpTafResp(aaf.access,bp.getName(),buildMsg(bp,req,
- "user/pass combo invalid via AAF from " + req.getRemoteAddr() + " - Retry limit exceeded"),
+ "user/pass combo invalid via AAF from " + req.getRemoteAddr() + " - Retry limit exceeded"),
RESP.FAIL,resp,aaf.getRealm(),true);
}
}
@@ -187,7 +187,7 @@ public class AAFTaf<CLIENT> extends AbsUserCache<AAFPermission> implements HttpT
}
return new BasicHttpTafResp(aaf.access,target,"Requesting HTTP Basic Authorization",RESP.TRY_AUTHENTICATING,resp,aaf.getRealm(),false);
}
-
+
private String buildMsg(Principal pr, HttpServletRequest req, Object... msg) {
StringBuilder sb = new StringBuilder();
for (Object s : msg) {
@@ -205,7 +205,7 @@ public class AAFTaf<CLIENT> extends AbsUserCache<AAFPermission> implements HttpT
}
-
+
public Resp revalidate(CachedPrincipal prin, Object state) {
// !!!! TEST THIS.. Things may not be revalidated, if not BasicPrincipal
if (prin instanceof BasicPrincipal) {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTrustChecker.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTrustChecker.java
index e3c1c9a3..e912fc53 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTrustChecker.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTrustChecker.java
@@ -101,7 +101,7 @@ public class AAFTrustChecker implements TrustChecker {
if (user_info == null) {
return tresp;
}
-
+
tresp.getAccess().log(Level.DEBUG, user_info);
String[] info = Split.split(',', user_info);
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java
index a654e6f6..06e2c62d 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -111,15 +111,15 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
this.version = (split.length > 1) ? split[1] : access.getProperty(Config.AAF_API_VERSION,Config.AAF_DEFAULT_API_VERSION);
}
}
-
+
/**
* This is the way to setup specialized AAFLocators ahead of time.
* @param preload
*/
public static void setCreator(LocatorCreator lc) {
- locatorCreator = lc;
+ locatorCreator = lc;
}
-
+
public static Locator<URI> create(final String name, final String version) throws LocatorException {
if(locatorCreator==null) {
throw new LocatorException("LocatorCreator is not set");
@@ -142,9 +142,9 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
return locatorURI.toString();
}
}
-
+
/**
- * Setting "self" excludes this service from the list. Critical for contacting peers.
+ * Setting "self" excludes this service from the list. Critical for contacting peers.
*/
public void setSelf(final String hostname, final int port) {
myhostname=hostname;
@@ -161,10 +161,10 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
protected final synchronized void replace(List<EP> list) {
epList = list;
}
-
+
/**
* Call _refresh as needed during calls, but actual refresh will not occur if there
- * are existing entities or if it has been called in the last 10 (settable) seconds.
+ * are existing entities or if it has been called in the last 10 (settable) seconds.
* Timed Refreshes happen by Scheduled Thread
*/
private final boolean _refresh() {
@@ -220,7 +220,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
public void invalidate(Item item) throws LocatorException {
if (item!=null) {
if (item instanceof AAFLItem) {
- AAFLItem ali =(AAFLItem)item;
+ AAFLItem ali =(AAFLItem)item;
EP ep = ali.ep;
synchronized(epList) {
epList.remove(ep);
@@ -237,9 +237,9 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
public Item best() throws LocatorException {
if (!hasItems()) {
throw new LocatorException(String.format("No Entries found for '%s/%s:%s'",
- (aaf_locator_uri==null?aaf_locator_host:aaf_locator_uri.toString()),
- name,
- version));
+ (aaf_locator_uri==null?aaf_locator_host:aaf_locator_uri.toString()),
+ name,
+ version));
}
List<EP> lep = new ArrayList<>();
EP first = null;
@@ -274,7 +274,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
} else {
return new AAFLItem(iter,lep.get(i));
}
-
+
}
}
@@ -291,7 +291,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
private final Object[] epa;
private final List<EP> epList;
private int idx;
-
+
public EPIterator(Object[] epa, List<EP> epList) {
this.epa = epa;
this.epList = epList;
@@ -332,7 +332,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
}
}
}
-
+
@Override
public Item first() {
Iterator<EP> iter = getIterator();
@@ -370,18 +370,18 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
}
return null;
}
-
+
protected static class AAFLItem implements Item {
private Iterator<EP> iter;
private URI uri;
private EP ep;
-
+
public AAFLItem(Iterator<EP> iter, EP ep) {
this.iter = iter;
this.ep = ep;
uri = ep.uri;
}
-
+
private static EP next(Iterator<EP> iter) {
EP ep=null;
while (iter.hasNext() && (ep==null || !ep.valid)) {
@@ -389,7 +389,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
}
return ep;
}
-
+
public String toString() {
return ep==null?"Locator Item Invalid":ep.toString();
}
@@ -399,7 +399,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
private URI uri;
private final double distance;
private boolean valid;
-
+
public EP(final Endpoint ep, double latitude, double longitude) throws URISyntaxException {
uri = new URI(ep.getProtocol(),null,ep.getHostname(),ep.getPort(),null,null,null);
distance = GreatCircle.calc(latitude, longitude, ep.getLatitude(), ep.getLongitude());
@@ -420,13 +420,13 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
return 0;
}
}
-
+
@Override
public String toString() {
return distance + ": " + uri + (valid?" valid":" invalidate");
}
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.cadi.Locator#destroy()
*/
@@ -434,7 +434,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
public void destroy() {
// Nothing to do
}
-
+
@Override
public String toString() {
return "AAFLocator for " + name + " on " + getURI();
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLur.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLur.java
index ac6fc063..8d42455c 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLur.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLur.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -67,12 +67,12 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE
public void details(boolean on) {
details = on;
}
-
+
public void setPreemptiveLur(Lur preemptive) {
this.preemptiveLur = preemptive;
}
-
+
protected abstract User<PERM> loadUser(Principal bait);
@Override
@@ -92,9 +92,9 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE
return false;
}
-
+
protected abstract boolean isCorrectPermType(Permission pond);
-
+
// This is where you build AAF CLient Code. Answer the question "Is principal "bait" in the "pond"
public boolean fish(Principal bait, Permission ... pond) {
if (preemptiveLur!=null && preemptiveLur.handles(bait)) {
@@ -235,7 +235,7 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE
}
}
}
-
+
@Override
public void remove(String user) {
super.remove(user);
@@ -257,7 +257,7 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE
}
/**
* This special case minimizes loops, avoids multiple Set hits, and calls all the appropriate Actions found.
- *
+ *
* @param bait
* @param obj
* @param type
@@ -279,7 +279,7 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE
}
}
}
-
+
public static interface Action<A> {
public String getName();
/**
@@ -288,7 +288,7 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE
*/
public boolean exec(A a);
}
-
+
private class ReuseAAFPermission extends AAFPermission {
public ReuseAAFPermission(String type, String instance) {
super(type,instance,null,null);
@@ -297,9 +297,9 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE
public void setAction(String s) {
action = s;
}
-
+
/**
- * This function understands that AAF Keys are hierarchical, :A:B:C,
+ * This function understands that AAF Keys are hierarchical, :A:B:C,
* Cassandra follows a similar method, so we'll short circuit and do it more efficiently when there isn't a first hit
* @return
*/
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
index 7d149fca..48109e47 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -94,11 +94,11 @@ public class Agent {
public static final String PKCS12 = "pkcs12";
public static final String JKS = "jks";
private static final String SCRIPT="script";
-
+
private static final String CM_VER = "1.0";
public static final int PASS_SIZE = 24;
private static int TIMEOUT;
-
+
private static RosettaDF<CertificateRequest> reqDF;
private static RosettaDF<CertInfo> certDF;
private static RosettaDF<Artifacts> artifactsDF;
@@ -107,10 +107,10 @@ public class Agent {
private static ErrMessage errMsg;
private static Map<String,PlaceArtifact> placeArtifact;
private static RosettaEnv env;
-
+
private static boolean doExit;
private static AAFCon<?> aafcon;
-
+
private static List<String> CRED_TAGS = Arrays.asList(new String[] {
Config.CADI_KEYFILE,
Config.AAF_APPID, Config.AAF_APPPASS,
@@ -149,8 +149,8 @@ public class Agent {
} else {
try {
AAFSSO aafsso=null;
- PropAccess access=null;
-
+ PropAccess access=null;
+
String hasEtc = null;
for(String a : args) {
if(a.startsWith(Config.CADI_PROP_FILES)) {
@@ -165,7 +165,7 @@ public class Agent {
configNoPasswd=true;
}
}
-
+
if(access==null) {
if(args.length>1 && args[1].contains("@")) {
String domain = FQI.reverseDomain(args[1]);
@@ -181,9 +181,9 @@ public class Agent {
}
}
}
- }
+ }
}
-
+
if(access==null) {
for(Entry<Object, Object> es : System.getProperties().entrySet()) {
if(Config.CADI_PROP_FILES.equals(es.getKey())) {
@@ -194,7 +194,7 @@ public class Agent {
// When using Config file, check if Cred Exists, and if not, work with Deployer.
if(access!=null && !"config".equals(args[0]) && access.getProperty(Config.AAF_APPPASS)==null && access.getProperty(Config.CADI_ALIAS)==null) {
- // not enough credentials to use Props. Use AAFSSO
+ // not enough credentials to use Props. Use AAFSSO
access = null;
}
@@ -213,7 +213,7 @@ public class Agent {
if (args.length>1) {
if (!args[0].equals("keypairgen")) {
props.put(Config.AAF_APPID, args[1]);
- }
+ }
}
return props;
}
@@ -221,7 +221,7 @@ public class Agent {
access = aafsso.access();
}
}
-
+
if (aafsso!=null && aafsso.loginOnly()) {
aafsso.setLogDefault();
aafsso.writeFiles();
@@ -239,7 +239,7 @@ public class Agent {
access.setProperty(p.substring(0,eq), p.substring(eq+1));
}
}
-
+
if (cmds.size()==0) {
if (aafsso!=null) {
aafsso.setLogDefault();
@@ -262,28 +262,28 @@ public class Agent {
System.out.println(" ** Type with no params for Tool Help");
System.out.println(" ** If using with Agent, preface with \"cadi\"");
System.out.println(" cadi <cadi tool params, see -?>");
-
+
if (doExit) {
System.exit(1);
}
}
-
+
TIMEOUT = Integer.parseInt(env.getProperty(Config.AAF_CONN_TIMEOUT, "5000"));
-
+
reqDF = env.newDataFactory(CertificateRequest.class);
artifactsDF = env.newDataFactory(Artifacts.class);
certDF = env.newDataFactory(CertInfo.class);
configDF = env.newDataFactory(Configuration.class);
permDF = env.newDataFactory(Perms.class);
errMsg = new ErrMessage(env);
-
+
placeArtifact = new HashMap<>();
placeArtifact.put(JKS, new PlaceArtifactInKeystore(JKS));
placeArtifact.put(PKCS12, new PlaceArtifactInKeystore(PKCS12));
placeArtifact.put(FILE, new PlaceArtifactInFiles());
placeArtifact.put(PRINT, new PlaceArtifactOnStream(System.out));
placeArtifact.put(SCRIPT, new PlaceArtifactScripts());
-
+
Trans trans = env.newTrans();
String token;
if ((token=access.getProperty("oauth_token"))!=null) {
@@ -294,13 +294,13 @@ public class Agent {
// show Std out again
aafsso.setLogDefault();
aafsso.setStdErrDefault();
-
+
/*urls=*/loadURLs(access);
aafsso.writeFiles();
}
-
-
-
+
+
+
String cmd = cmds.removeFirst();
switch(cmd) {
case "place":
@@ -397,7 +397,7 @@ public class Agent {
lhost=Config.AAF_LOCATE_URL_TAG;
}
value = rph.replacements(AGENT_LOAD_URLS,
- proto + lhost + "/%CNS.%AAF_NS." + ("aaf".equals(u)?"service":u) + ':' + version,
+ proto + lhost + "/%CNS.%AAF_NS." + ("aaf".equals(u)?"service":u) + ':' + version,
null,dot_le);
if(append!=null) {
value+=append;
@@ -457,7 +457,7 @@ public class Agent {
}
return alias!=null?alias:AAFSSO.cons.readLine("AppID: ");
}
- return cmds.removeFirst();
+ return cmds.removeFirst();
}
private static String machine(Deque<String> cmds) throws UnknownHostException {
@@ -489,7 +489,7 @@ public class Agent {
arti.setMechid(mechID!=null?mechID:AAFSSO.cons.readLine("AppID: "));
arti.setMachine(machine!=null?machine:AAFSSO.cons.readLine("Machine (%s): ",InetAddress.getLocalHost().getHostName()));
arti.setCa(AAFSSO.cons.readLine("CA: (%s): ","aaf"));
-
+
String resp = AAFSSO.cons.readLine("Types [file,pkcs12,jks,script] (%s): ", PKCS12);
for (String s : Split.splitTrim(',', resp)) {
arti.getType().add(s);
@@ -506,7 +506,7 @@ public class Agent {
arti.setOsUser(AAFSSO.cons.readLine("OS User (%s): ", System.getProperty("user.name")));
arti.setRenewDays(Integer.parseInt(AAFSSO.cons.readLine("Renewal Days (%s):", "30")));
arti.setNotification(toNotification(AAFSSO.cons.readLine("Notification (mailto owner):", "")));
-
+
TimeTaken tt = trans.start("Create Artifact", Env.REMOTE);
try {
Future<Artifacts> future = aafcon.client(CM_VER).create("/cert/artifacts", artifactsDF, artifacts);
@@ -531,7 +531,7 @@ public class Agent {
}
return notification;
}
-
+
private static void readArtifact(Trans trans, AAFCon<?> aafcon, Deque<String> cmds) throws Exception {
String mechID = fqi(cmds);
@@ -541,14 +541,14 @@ public class Agent {
try {
Future<Artifacts> future = aafcon.client(CM_VER)
.read("/cert/artifacts/"+mechID+'/'+machine, artifactsDF,"Authorization","Bearer " + trans.getProperty("oauth_token"));
-
+
if (future.get(TIMEOUT)) {
boolean printed = false;
for (Artifact a : future.value.getArtifact()) {
- AAFSSO.cons.printf("AppID: %s\n",a.getMechid());
- AAFSSO.cons.printf(" Sponsor: %s\n",a.getSponsor());
- AAFSSO.cons.printf("Machine: %s\n",a.getMachine());
- AAFSSO.cons.printf("CA: %s\n",a.getCa());
+ AAFSSO.cons.printf("AppID: %s\n",a.getMechid());
+ AAFSSO.cons.printf(" Sponsor: %s\n",a.getSponsor());
+ AAFSSO.cons.printf("Machine: %s\n",a.getMachine());
+ AAFSSO.cons.printf("CA: %s\n",a.getCa());
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String t : a.getType()) {
@@ -557,7 +557,7 @@ public class Agent {
sb.append(t);
}
AAFSSO.cons.printf("Types: %s\n",sb);
- AAFSSO.cons.printf("Namespace: %s\n",a.getNs());
+ AAFSSO.cons.printf("Namespace: %s\n",a.getNs());
AAFSSO.cons.printf("Directory: %s\n",a.getDir());
AAFSSO.cons.printf("O/S User: %s\n",a.getOsUser());
AAFSSO.cons.printf("Renew Days: %d\n",a.getRenewDays());
@@ -574,7 +574,7 @@ public class Agent {
tt.done();
}
}
-
+
private static void copyArtifact(Trans trans, AAFCon<?> aafcon, Deque<String> cmds) throws Exception {
String mechID = fqi(cmds);
String machine = machine(cmds);
@@ -586,7 +586,7 @@ public class Agent {
try {
Future<Artifacts> future = aafcon.client(CM_VER)
.read("/cert/artifacts/"+mechID+'/'+machine, artifactsDF);
-
+
if (future.get(TIMEOUT)) {
boolean printed = false;
for (Artifact a : future.value.getArtifact()) {
@@ -599,7 +599,7 @@ public class Agent {
trans.error().printf("Call to AAF Certman failed, %s",
errMsg.toMsg(fup));
}
-
+
printed = true;
}
}
@@ -623,13 +623,13 @@ public class Agent {
try {
Future<Artifacts> fread = aafcon.client(CM_VER)
.read("/cert/artifacts/"+mechID+'/'+machine, artifactsDF);
-
+
if (fread.get(TIMEOUT)) {
Artifacts artifacts = new Artifacts();
for (Artifact a : fread.value.getArtifact()) {
Artifact arti = new Artifact();
artifacts.getArtifact().add(arti);
-
+
AAFSSO.cons.printf("For %s on %s\n", a.getMechid(),a.getMachine());
arti.setMechid(a.getMechid());
arti.setMachine(a.getMachine());
@@ -641,7 +641,7 @@ public class Agent {
else{sb.append(',');}
sb.append(t);
}
-
+
String resp = AAFSSO.cons.readLine("Types [file,jks,pkcs12] (%s): ", sb);
for (String s : Split.splitTrim(',', resp)) {
arti.getType().add(s);
@@ -657,7 +657,7 @@ public class Agent {
arti.setOsUser(AAFSSO.cons.readLine("OS User (%s): ", a.getOsUser()));
arti.setRenewDays(Integer.parseInt(AAFSSO.cons.readLine("Renew Days (%s):", a.getRenewDays())));
arti.setNotification(toNotification(AAFSSO.cons.readLine("Notification (%s):", a.getNotification())));
-
+
}
if (artifacts.getArtifact().size()==0) {
AAFSSO.cons.printf("Artifact for %s %s does not exist", mechID, machine);
@@ -678,16 +678,16 @@ public class Agent {
tt.done();
}
}
-
+
private static void deleteArtifact(Trans trans, AAFCon<?> aafcon, Deque<String> cmds) throws Exception {
String mechid = fqi(cmds);
String machine = machine(cmds);
-
+
TimeTaken tt = trans.start("Delete Artifact", Env.REMOTE);
try {
Future<Void> future = aafcon.client(CM_VER)
.delete("/cert/artifacts/"+mechid+"/"+machine,"application/json" );
-
+
if (future.get(TIMEOUT)) {
trans.info().printf("Call to AAF Certman successful %s, %s",mechid,machine);
} else {
@@ -699,7 +699,7 @@ public class Agent {
}
}
-
+
private static boolean placeCerts(Trans trans, AAFCon<?> aafcon, Deque<String> cmds) throws Exception {
boolean rv = false;
@@ -713,7 +713,7 @@ public class Agent {
} else {
key = machine;
}
-
+
TimeTaken tt = trans.start("Place Artifact", Env.REMOTE);
try {
Future<Artifacts> acf = aafcon.client(CM_VER)
@@ -761,7 +761,7 @@ public class Agent {
}
return rv;
}
-
+
private static void notifyPlaced(Artifact a, boolean rv) {
}
@@ -783,10 +783,10 @@ public class Agent {
boolean allowed;
for (Artifact a : acf.value.getArtifact()) {
allowed = id!=null && (id.equals(a.getSponsor()) ||
- (id.equals(a.getMechid())
+ (id.equals(a.getMechid())
&& aafcon.securityInfo().defSS.getClass().isAssignableFrom(HBasicAuthSS.class)));
if (!allowed) {
- Future<String> pf = aafcon.client(CM_VER).read("/cert/may/" +
+ Future<String> pf = aafcon.client(CM_VER).read("/cert/may/" +
a.getNs()+"|certman|"+a.getCa()+"|showpass","*/*");
if (pf.get(TIMEOUT)) {
allowed = true;
@@ -809,11 +809,11 @@ public class Agent {
} finally {
fis.close();
}
-
+
File f = new File(dir,a.getNs()+".keyfile");
if (f.exists()) {
Symm symm = ArtifactDir.getSymm(f);
-
+
for (Iterator<Entry<Object,Object>> iter = props.entrySet().iterator(); iter.hasNext();) {
Entry<Object,Object> en = iter.next();
if (en.getValue().toString().startsWith("enc:")) {
@@ -835,13 +835,13 @@ public class Agent {
}
}
-
+
private static void keypairGen(final Trans trans, final PropAccess access, final Deque<String> cmds) throws IOException {
final String fqi = fqi(cmds);
final String ns = FQI.reverseDomain(fqi);
File dir = new File(access.getProperty(Config.CADI_ETCDIR,".")); // default to current Directory
File f = new File(dir,ns+".key");
-
+
if (f.exists()) {
String line = AAFSSO.cons.readLine("%s exists. Overwrite? (y/n): ", f.getCanonicalPath());
if (!"Y".equalsIgnoreCase(line)) {
@@ -849,7 +849,7 @@ public class Agent {
return;
}
}
-
+
KeyPair kp = Factory.generateKeyPair(trans);
ArtifactDir.write(f, Chmod.to400, Factory.toString(trans, kp.getPrivate()));
System.out.printf("Wrote %s\n", f.getCanonicalFile());
@@ -858,7 +858,7 @@ public class Agent {
ArtifactDir.write(f, Chmod.to644, Factory.toString(trans, kp.getPublic()));
System.out.printf("Wrote %s\n", f.getCanonicalFile());
}
-
+
private static void config(Trans trans, PropAccess propAccess, String[] args, Deque<String> cmds) throws Exception {
TimeTaken tt = trans.start("Get Configuration", Env.REMOTE);
try {
@@ -880,7 +880,7 @@ public class Agent {
for (String tag : LOC_TAGS) {
loc.add(tag, getProperty(propAccess, trans, false, tag, "%s: ",tag));
}
-
+
String keyfile = cred.getKeyPath();
if(keyfile!=null) {
File fkeyfile = new File(keyfile);
@@ -901,13 +901,13 @@ public class Agent {
}
}
}
-
+
// load all properties that are already setup.
Map<String, String> aaf_urls = loadURLs(propAccess);
for(Entry<String, String> es : aaf_urls.entrySet()) {
app.add(es.getKey(), es.getValue());
}
-
+
app.add(Config.AAF_LOCATE_URL, Config.getAAFLocateUrl(propAccess));
app.add(Config.AAF_ENV,propAccess, "DEV");
String release = propAccess.getProperty(Config.AAF_DEPLOYED_VERSION);
@@ -923,7 +923,7 @@ public class Agent {
app.add(key, aaf_loc_prop.getValue().toString());
}
}
-
+
app.add(Config.AAF_APPID, fqi);
String cts = propAccess.getProperty(Config.CADI_TRUSTSTORE);
@@ -941,7 +941,7 @@ public class Agent {
if (fcpf.exists()) {
int lastSep = cts.lastIndexOf(File.pathSeparator);
origTruststore = new File(fcpf.getParentFile(),lastSep>=0?cts.substring(lastSep):cts);
- if (origTruststore.exists()) {
+ if (origTruststore.exists()) {
break;
}
}
@@ -950,7 +950,7 @@ public class Agent {
throw new CadiException(cts + " does not exist");
}
}
-
+
}
if (!newTruststore.exists() && origTruststore.exists()) {
Files.copy(origTruststore.toPath(), newTruststore.toPath());
@@ -960,14 +960,14 @@ public class Agent {
System.out.println("New Truststore is " + newTruststore);
cred.add(Config.CADI_TRUSTSTORE, newTruststore.getCanonicalPath());
cred.add(Config.CADI_TRUSTSTORE_PASSWORD, "changeit" /* Java default */);
-
+
String cpf = propAccess.getProperty(Config.CADI_PROP_FILES);
if (cpf!=null){
- String[] propFiles = Split.splitTrim(File.pathSeparatorChar, cpf);
+ String[] propFiles = Split.splitTrim(File.pathSeparatorChar, cpf);
for (int pfi = propFiles.length-1;pfi>=0;--pfi) {
String f = propFiles[pfi];
System.out.format("Reading %s\n",f);
- FileInputStream fis = new FileInputStream(f);
+ FileInputStream fis = new FileInputStream(f);
try {
Properties props = new Properties();
props.load(fis);
@@ -1010,7 +1010,7 @@ public class Agent {
}
}
}
-
+
PropHolder.writeAll();
} finally {
tt.done();
@@ -1062,12 +1062,12 @@ public class Agent {
/**
* Check returns Error Codes, so that Scripts can know what to do
- *
+ *
* 0 - Check Complete, nothing to do
* 1 - General Error
* 2 - Error for specific Artifact - read check.msg
* 10 - Certificate Updated - check.msg is email content
- *
+ *
* @param trans
* @param aafcon
* @param cmds
@@ -1078,10 +1078,10 @@ public class Agent {
int exitCode=1;
String mechID = fqi(cmds);
String machine = machine(cmds);
-
+
TimeTaken tt = trans.start("Check Certificate", Env.REMOTE);
try {
-
+
Future<Artifacts> acf = aafcon.client(CM_VER)
.read("/cert/artifacts/"+mechID+'/'+machine, artifactsDF);
if (acf.get(TIMEOUT)) {
@@ -1102,10 +1102,10 @@ public class Agent {
} finally {
fis.close();
}
-
- String prop;
+
+ String prop;
File f;
-
+
if ((prop=trans.getProperty(Config.CADI_KEYFILE))==null ||
!(f=new File(prop)).exists()) {
trans.error().printf("Keyfile must exist to check Certificates for %s on %s",
@@ -1120,7 +1120,7 @@ public class Agent {
Symm symm = ArtifactDir.getSymm(f);
KeyStore ks = KeyStore.getInstance("JKS");
-
+
fis = new FileInputStream(ksf);
try {
ks.load(fis,symm.depass(ksps).toCharArray());
@@ -1140,21 +1140,21 @@ public class Agent {
renew.setTime(cert.getNotAfter());
renew.add(GregorianCalendar.DAY_OF_MONTH,-1*a.getRenewDays());
if (renew.after(now)) {
- msg = String.format("X509Certificate for %s on %s has been checked on %s. It expires on %s; it will not be renewed until %s.\n",
+ msg = String.format("X509Certificate for %s on %s has been checked on %s. It expires on %s; it will not be renewed until %s.\n",
a.getMechid(), a.getMachine(),Chrono.dateOnlyStamp(now),cert.getNotAfter(),Chrono.dateOnlyStamp(renew));
trans.info().log(msg);
exitCode = 0; // OK
} else {
- trans.info().printf("X509Certificate for %s on %s expiration, %s, needs Renewal.\n",
+ trans.info().printf("X509Certificate for %s on %s expiration, %s, needs Renewal.\n",
a.getMechid(), a.getMachine(),cert.getNotAfter());
cmds.offerLast(mechID);
cmds.offerLast(machine);
if (placeCerts(trans,aafcon,cmds)) {
- msg = String.format("X509Certificate for %s on %s has been renewed. Ensure services using are refreshed.\n",
+ msg = String.format("X509Certificate for %s on %s has been renewed. Ensure services using are refreshed.\n",
a.getMechid(), a.getMachine());
exitCode = 10; // Refreshed
} else {
- msg = String.format("X509Certificate for %s on %s attempted renewal, but failed. Immediate Investigation is required!\n",
+ msg = String.format("X509Certificate for %s on %s attempted renewal, but failed. Immediate Investigation is required!\n",
a.getMechid(), a.getMachine());
exitCode = 1; // Error Renewing
}
@@ -1169,7 +1169,7 @@ public class Agent {
}
}
}
-
+
}
}
}
@@ -1185,7 +1185,7 @@ public class Agent {
}
}
-
-
+
+
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/ArtifactDir.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/ArtifactDir.java
index 0971ae0c..31a2410d 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/ArtifactDir.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/ArtifactDir.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -42,19 +42,19 @@ public abstract class ArtifactDir implements PlaceArtifact {
protected static final String C_R = "\n";
protected File dir;
-
+
// This checks for multiple passes of Dir on the same objects. Run clear after done.
protected final static Map<String,Object> processed = new HashMap<>();
private static final Map<String, Symm> symms = new HashMap<>();
-
+
/**
- * Note: Derived Classes should ALWAYS call "super.place(cert,arti)" first, and
+ * Note: Derived Classes should ALWAYS call "super.place(cert,arti)" first, and
* then "placeProperties(arti)" just after they implement
*/
@Override
public final boolean place(Trans trans, CertInfo certInfo, Artifact arti, String machine) throws CadiException {
validate(arti);
-
+
try {
PropHolder cred = PropHolder.get(arti,"cred.props");
@@ -67,7 +67,7 @@ public abstract class ArtifactDir implements PlaceArtifact {
throw new CadiException("Could not create " + dir);
}
}
-
+
// Obtain Issuers
boolean first = true;
StringBuilder issuers = new StringBuilder();
@@ -83,9 +83,9 @@ public abstract class ArtifactDir implements PlaceArtifact {
cred.addEnc("Challenge", certInfo.getChallenge());
}
-
+
_place(trans, certInfo,arti);
-
+
processed.put("dir",dir);
} catch (Exception e) {
@@ -106,7 +106,7 @@ public abstract class ArtifactDir implements PlaceArtifact {
public static void write(File f, Chmod c, String ... data) throws IOException {
System.out.println("Writing file " + f.getCanonicalPath());
f.setWritable(true,true);
-
+
FileOutputStream fos = new FileOutputStream(f);
PrintStream ps = new PrintStream(fos);
try {
@@ -122,7 +122,7 @@ public abstract class ArtifactDir implements PlaceArtifact {
public static void write(File f, Chmod c, byte[] bytes) throws IOException {
System.out.println("Writing file " + f.getCanonicalPath());
f.setWritable(true,true);
-
+
FileOutputStream fos = new FileOutputStream(f);
try {
fos.write(bytes);
@@ -131,11 +131,11 @@ public abstract class ArtifactDir implements PlaceArtifact {
c.chmod(f);
}
}
-
+
public static void write(File f, Chmod c, KeyStore ks, char[] pass ) throws IOException, CadiException {
System.out.println("Writing file " + f.getCanonicalPath());
f.setWritable(true,true);
-
+
FileOutputStream fos = new FileOutputStream(f);
try {
ks.store(fos, pass);
@@ -156,7 +156,7 @@ public abstract class ArtifactDir implements PlaceArtifact {
// } else {
// System.out.println("Encryptor using " + f.getCanonicalPath());
}
- symm = Symm.obtain(f);
+ symm = Symm.obtain(f);
symms.put(f.getCanonicalPath(),symm);
}
return symm;
@@ -174,7 +174,7 @@ public abstract class ArtifactDir implements PlaceArtifact {
}
sb.append("File Artifacts require an AAF Namespace");
}
-
+
if (sb.length()>0) {
throw new CadiException(sb.toString());
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/CertException.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/CertException.java
index 526673e3..889acf11 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/CertException.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/CertException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,7 @@ package org.onap.aaf.cadi.configure;
public class CertException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = 1373028409048516401L;
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Factory.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Factory.java
index 642b2d29..775e2246 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Factory.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Factory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -79,8 +79,8 @@ public class Factory {
private static final KeyFactory keyFactory;
private static final CertificateFactory certificateFactory;
private static final SecureRandom random;
-
-
+
+
private static final Symm base64 = Symm.base64.copy(64);
static {
@@ -103,7 +103,7 @@ public class Factory {
e.printStackTrace(System.err);
};
keyFactory = tempKeyFactory;
-
+
CertificateFactory tempCertificateFactory;
try {
tempCertificateFactory = CertificateFactory.getInstance("X.509");
@@ -113,7 +113,7 @@ public class Factory {
}
certificateFactory = tempCertificateFactory;
-
+
}
@@ -131,7 +131,7 @@ public class Factory {
tt.done();
}
}
- }
+ }
private static final String LINE_END = "-----\n";
@@ -145,7 +145,7 @@ public class Factory {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
base64.encode(bais, baos);
sb.append(new String(baos.toByteArray()));
-
+
if (sb.charAt(sb.length()-1)!='\n') {
sb.append('\n');
}
@@ -154,7 +154,7 @@ public class Factory {
sb.append(LINE_END);
return sb.toString();
}
-
+
public static PrivateKey toPrivateKey(Trans trans, String pk) throws IOException, CertException {
byte[] bytes = decode(new StringReader(pk), null);
return toPrivateKey(trans, bytes);
@@ -202,7 +202,7 @@ public class Factory {
tt.done();
}
}
-
+
public static String toString(Trans trans, PublicKey pk) throws IOException {
trans.debug().log("Public Key to String");
return textBuilder("PUBLIC KEY",pk.getEncoded());
@@ -211,7 +211,7 @@ public class Factory {
public static Collection<? extends Certificate> toX509Certificate(String x509) throws CertificateException {
return toX509Certificate(x509.getBytes());
}
-
+
public static Collection<? extends Certificate> toX509Certificate(List<String> x509s) throws CertificateException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
@@ -265,7 +265,7 @@ public class Factory {
}
public static Cipher pkCipher() throws NoSuchAlgorithmException, NoSuchPaddingException {
- return Cipher.getInstance(KEY_ALGO);
+ return Cipher.getInstance(KEY_ALGO);
}
public static Cipher pkCipher(Key key, boolean encrypt) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException {
@@ -277,7 +277,7 @@ public class Factory {
public static byte[] strip(Reader rdr) throws IOException {
return strip(rdr,null);
}
-
+
public static byte[] strip(Reader rdr, Holder<String> hs) throws IOException {
BufferedReader br = new BufferedReader(rdr);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -317,7 +317,7 @@ public class Factory {
}
created = null;
}
-
+
public StripperInputStream(File file) throws FileNotFoundException {
this(new FileReader(file));
created = br;
@@ -365,7 +365,7 @@ public class Factory {
private byte duo[];
private int idx;
-
+
public Base64InputStream(File file) throws FileNotFoundException {
this(new FileInputStream(file));
created = is;
@@ -390,7 +390,7 @@ public class Factory {
}
idx=0;
}
-
+
return duo[idx++];
}
@@ -411,7 +411,7 @@ public class Factory {
Symm.base64.decode(bais, baos);
return baos.toByteArray();
}
-
+
public static byte[] decode(File f, Holder<String> hs) throws IOException {
FileReader fr = new FileReader(f);
try {
@@ -464,12 +464,12 @@ public class Factory {
return sig.verify(signature);
} finally {
tt.done();
- }
+ }
}
/**
* Get the Security Provider, or, if not exists yet, attempt to load
- *
+ *
* @param providerType
* @param params
* @return
@@ -480,7 +480,7 @@ public class Factory {
if (p!=null) {
switch(providerType) {
case "PKCS12":
-
+
break;
case "PKCS11": // PKCS11 only known to be supported by Sun
try {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifact.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifact.java
index 2d7d3124..febe01e2 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifact.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifact.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInFiles.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInFiles.java
index 93c5a12a..d3a3e393 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInFiles.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInFiles.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,11 +38,11 @@ public class PlaceArtifactInFiles extends ArtifactDir {
File f = new File(dir,arti.getNs()+".crt");
// In Version 1.0, App Cert is first
write(f,Chmod.to644,certInfo.getCerts().get(0),C_R);
-
+
// Setup Private Key
f = new File(dir,arti.getNs()+".key");
write(f,Chmod.to400,certInfo.getPrivatekey(),C_R);
-
+
} catch (Exception e) {
throw new CadiException(e);
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java
index 18d74fba..31ca3275 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -57,12 +57,12 @@ public class PlaceArtifactInKeystore extends ArtifactDir {
if (fks.exists()) {
File backup = File.createTempFile(fks.getName()+'.', ".backup",dir);
fks.renameTo(backup);
- }
+ }
// Get the Cert(s)... Might include Trust store
Collection<? extends Certificate> certColl = Factory.toX509Certificate(certInfo.getCerts());
// find where the trusts end in 1.0 API
-
+
X509Certificate x509;
List<X509Certificate> chainList = new ArrayList<>();
Set<X509Certificate> caSet = new HashSet<>();
@@ -73,7 +73,7 @@ public class PlaceArtifactInKeystore extends ArtifactDir {
if (x509.getSubjectDN().equals(x509.getIssuerDN())) {
caSet.add(x509);
} else {
- // Expect Certs in Trust Chain Order.
+ // Expect Certs in Trust Chain Order.
if(curr==null) {
chainList.add(x509);
curr=x509;
@@ -103,12 +103,12 @@ public class PlaceArtifactInKeystore extends ArtifactDir {
props.add(Config.CADI_KEYSTORE_PASSWORD+'_'+ext,encP);
char[] keystorePassArray = keystorePass.toCharArray();
jks.load(null,keystorePassArray); // load in
-
+
// Add Private Key/Cert Entry for App
// Note: Java SSL security classes, while having a separate key from keystore,
- // is documented to not actually work.
+ // is documented to not actually work.
// java.security.UnrecoverableKeyException: Cannot recover key
- // You can create a custom Key Manager to make it work, but Practicality
+ // You can create a custom Key Manager to make it work, but Practicality
// dictates that you live with the default, meaning, they are the same
String keyPass = keystorePass; //Symm.randomGen(CmAgent.PASS_SIZE);
PrivateKey pk = Factory.toPrivateKey(trans, certInfo.getPrivatekey());
@@ -118,38 +118,38 @@ public class PlaceArtifactInKeystore extends ArtifactDir {
// if (kst.equals("pkcs12")) {
// // Friendly Name
// attribs.add(new PKCS12Attribute("1.2.840.113549.1.9.20", arti.getNs()));
-// }
-//
- KeyStore.ProtectionParameter protParam =
+// }
+//
+ KeyStore.ProtectionParameter protParam =
new KeyStore.PasswordProtection(keyPass.toCharArray());
-
+
Certificate[] trustChain = new Certificate[chainList.size()];
chainList.toArray(trustChain);
- KeyStore.PrivateKeyEntry pkEntry =
+ KeyStore.PrivateKeyEntry pkEntry =
new KeyStore.PrivateKeyEntry(pk, trustChain);
- jks.setEntry(arti.getMechid(),
+ jks.setEntry(arti.getMechid(),
pkEntry, protParam);
// Write out
write(fks,Chmod.to644,jks,keystorePassArray);
-
+
// Change out to TrustStore
// NOTE: PKCS12 does NOT support Trusted Entries. Put in JKS Always
fks = new File(dir,arti.getNs()+".trust.jks");
if (fks.exists()) {
File backup = File.createTempFile(fks.getName()+'.', ".backup",dir);
fks.renameTo(backup);
- }
+ }
jks = KeyStore.getInstance(Agent.JKS);
-
+
// Set Truststore Password
props.add(Config.CADI_TRUSTSTORE,fks.getAbsolutePath());
String trustStorePass = Symm.randomGen(Agent.PASS_SIZE);
props.addEnc(Config.CADI_TRUSTSTORE_PASSWORD,trustStorePass);
char[] truststorePassArray = trustStorePass.toCharArray();
jks.load(null,truststorePassArray); // load in
-
+
// Add Trusted Certificates, but PKCS12 doesn't support
Certificate[] trustCAs = new Certificate[caSet.size()];
caSet.toArray(trustCAs);
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactOnStream.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactOnStream.java
index fcc1f623..2dc38825 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactOnStream.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactOnStream.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactScripts.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactScripts.java
index 05ffdbfe..48f0e622 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactScripts.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactScripts.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,7 +47,7 @@ public class PlaceArtifactScripts extends ArtifactDir {
} else {
email=arti.getOsUser() + '\n';
}
-
+
StringBuilder classpath = new StringBuilder();
boolean first = true;
for (String pth : Split.split(File.pathSeparatorChar, System.getProperty("java.class.path"))) {
@@ -59,13 +59,13 @@ public class PlaceArtifactScripts extends ArtifactDir {
File f = new File(pth);
classpath.append(f.getCanonicalPath().replaceAll("[0-9]+\\.[0-9]+\\.[0-9]+",Defaults.AAF_VERSION+".*"));
}
-
+
write(f1,Chmod.to644,
"#!/bin/bash " + f1.getCanonicalPath()+'\n',
"# Certificate Manager Check Script\n",
"# Check on Certificate, and renew if needed.\n",
"# Generated by Certificate Manager " + Chrono.timeStamp()+'\n',
- "# by Deployer " + trans.getProperty(Config.AAF_APPID,"") + '\n',
+ "# by Deployer " + trans.getProperty(Config.AAF_APPID,"") + '\n',
"#\n",
"DIR="+arti.getDir()+'\n',
"APP_ID=" + arti.getMechid() + '\n',
@@ -80,7 +80,7 @@ public class PlaceArtifactScripts extends ArtifactDir {
"fi\n",
checkScript
);
-
+
// Setup check.sh script
File f2 = new File(dir,arti.getNs()+".crontab.sh");
write(f2,Chmod.to644,
@@ -100,9 +100,9 @@ public class PlaceArtifactScripts extends ArtifactDir {
}
return true;
}
-
+
/**
- * Note: java.home gets Absolute Path of Java, where we probably want soft links from
+ * Note: java.home gets Absolute Path of Java, where we probably want soft links from
* JAVA_HOME
* @return
*/
@@ -110,7 +110,7 @@ public class PlaceArtifactScripts extends ArtifactDir {
String rc = System.getenv("JAVA_HOME");
return rc==null?System.getProperty("java.home"):rc;
}
- private final static String checkScript =
+ private final static String checkScript =
"function mailit {\n" +
" if [ -e /bin/mail ]; then\n" +
" MAILER=/bin/mail\n" +
@@ -150,8 +150,8 @@ public class PlaceArtifactScripts extends ArtifactDir {
" ;;\n" +
" esac\n\n" +
" # Note: make sure to cover this sripts' exit Code\n";
-
- private final static String cronScript =
+
+ private final static String cronScript =
"crontab -l | sed -n \"/#### BEGIN $CF/,/END $CF ####/!p\" > $TFILE\n" +
"# Note: Randomize Minutes (0-60) and hours (1-4)\n" +
"echo \"#### BEGIN $CF ####\" >> $TFILE\n" +
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java
index 3140df61..a0bd6e8b 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -68,10 +68,10 @@ public class PropHolder {
if(ph == null) {
ph = new PropHolder(dir,file,new File(dir,arti.getNs()+".keyfile"));
propHolders.put(file.getAbsolutePath(), ph);
- }
+ }
return ph;
}
-
+
private PropHolder(File dir, File file, File keyfile) throws IOException {
this.dir = dir;
this.file = file;
@@ -79,11 +79,11 @@ public class PropHolder {
symm = null;
props = new TreeMap<>();
}
-
+
public String getPath() {
return file.getAbsolutePath();
}
-
+
public File getDir() {
return dir;
}
@@ -125,7 +125,7 @@ public class PropHolder {
}
addEnc(tag,pwd);
}
-
+
public void write() throws IOException {
if (props.size()==0) {
return;
@@ -138,7 +138,7 @@ public class PropHolder {
} else {
System.out.println("Creating new " + file.getCanonicalPath());
}
-
+
// Append if not first
PrintWriter pw = new PrintWriter(new FileWriter(file));
try {
@@ -157,7 +157,7 @@ public class PropHolder {
pw.print('#');
}
pw.println();
-
+
for (Map.Entry<String,String> me : props.entrySet()) {
String key = me.getKey();
pw.print(key);
@@ -169,13 +169,13 @@ public class PropHolder {
}
Chmod.to644.chmod(file);
}
-
+
public static void writeAll() throws IOException {
for(PropHolder ph : propHolders.values()) {
ph.write();
}
}
-
+
@Override
public String toString() {
return file.getAbsolutePath() + ": " + props;
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AAFToken.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AAFToken.java
index f3ff3898..099ea282 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AAFToken.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AAFToken.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,7 +29,7 @@ import org.onap.aaf.cadi.Hash;
public class AAFToken {
private static final int CAPACITY = (Long.SIZE*2+Byte.SIZE*3)/8;
- private static final SecureRandom sr = new SecureRandom();
+ private static final SecureRandom sr = new SecureRandom();
public static final String toToken(UUID uuid) {
long lsb = uuid.getLeastSignificantBits();
@@ -67,7 +67,7 @@ public class AAFToken {
long lsb = bb.getLong();
byte b3 = (byte)(0x3F&bb.get());
int sum=35;
-
+
for (int i=0;i<Long.SIZE;i+=8) {
sum+=((lsb>>i) & 0xFF);
}
@@ -78,9 +78,9 @@ public class AAFToken {
if (b1!=((byte)sum) ||
b2!=((byte)(sum>>8)) ||
b3!=((byte)((sum>>16)))) {
- return null; // not a CADI Token
+ return null; // not a CADI Token
}
return new UUID(msb, lsb);
}
-
+
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AbsOTafLur.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AbsOTafLur.java
index 29d0933c..7dfb44d5 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AbsOTafLur.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AbsOTafLur.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,7 +41,7 @@ public abstract class AbsOTafLur {
protected final PropAccess access;
protected final String client_id;
protected static Pool<TokenClient> tokenClientPool;
-
+
protected AbsOTafLur(final PropAccess access, final String token_url, final String introspect_url) throws CadiException {
this.access = access;
String ci;
@@ -68,18 +68,18 @@ public abstract class AbsOTafLur {
private TokenClientFactory tcf;
private final int timeout;
private final String url,enc_secret;
-
- public TCCreator(PropAccess access) throws CadiException {
+
+ public TCCreator(PropAccess access) throws CadiException {
try {
tcf = TokenClientFactory.instance(access);
} catch (APIException | GeneralSecurityException | IOException e1) {
throw new CadiException(e1);
}
-
+
if ((url = access.getProperty(Config.AAF_OAUTH2_TOKEN_URL,null))==null) {
throw new CadiException(Config.AAF_OAUTH2_TOKEN_URL + REQUIRED_FOR_OAUTH2);
}
-
+
try {
timeout = Integer.parseInt(access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF));
} catch (NumberFormatException e) {
@@ -89,7 +89,7 @@ public abstract class AbsOTafLur {
throw new CadiException(Config.AAF_APPPASS + REQUIRED_FOR_OAUTH2);
}
}
-
+
@Override
public TokenClient create() throws APIException {
try {
@@ -121,14 +121,14 @@ public abstract class AbsOTafLur {
public void destroy() {
tkMgr.close();
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.cadi.Lur#clear(java.security.Principal, java.lang.StringBuilder)
*/
public void clear(Principal p, StringBuilder report) {
tkMgr.clear(p, report);
}
-
-
+
+
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/HRenewingTokenSS.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/HRenewingTokenSS.java
index 0e57dee8..10a975b8 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/HRenewingTokenSS.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/HRenewingTokenSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,11 +40,11 @@ public class HRenewingTokenSS extends HAuthorizationHeader {
private final TokenClient tc;
private final String[] scopes;
private final String tokenURL;
-
+
public HRenewingTokenSS(final PropAccess access, final String tokenURL, final String ... nss) throws CadiException, IOException, GeneralSecurityException {
this(access,SecurityInfoC.instance(access, HttpURLConnection.class),tokenURL,nss);
}
-
+
public HRenewingTokenSS(final PropAccess access, final SecurityInfoC<HttpURLConnection> si, final String tokenURL, final String ... nss) throws CadiException, IOException, GeneralSecurityException {
super(si,null,null/*Note: HeadValue overloaded */);
this.tokenURL = tokenURL;
@@ -62,7 +62,7 @@ public class HRenewingTokenSS extends HAuthorizationHeader {
}
}
if (hasDefault) {
- scopes=nss;
+ scopes=nss;
} else {
String[] nssPlus = new String[nss.length+1];
nssPlus[0]=defaultNS;
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTaf.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTaf.java
index 27e92142..e22eed0b 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTaf.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTaf.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -48,7 +48,7 @@ public class OAuth2HttpTaf implements HttpTaf {
this.tmgr = tmgr;
this.access = access;
}
-
+
@Override
public TafResp validate(LifeForm reading, HttpServletRequest req, HttpServletResponse resp) {
String authz = req.getHeader("Authorization");
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTafResp.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTafResp.java
index 4fa58700..cc0d26bc 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTafResp.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTafResp.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,23 +35,23 @@ public class OAuth2HttpTafResp extends AbsTafResp implements TafResp {
private HttpServletResponse httpResp;
private RESP status;
private final boolean wasFailed;
-
+
public OAuth2HttpTafResp(Access access, OAuth2Principal principal, String desc, RESP status, HttpServletResponse resp, boolean wasFailed) {
super(access,tafName, principal, desc);
httpResp = resp;
- this.status = status;
+ this.status = status;
this.wasFailed = wasFailed;
}
public OAuth2HttpTafResp(Access access, TrustPrincipal principal, String desc, RESP status,HttpServletResponse resp) {
super(access,tafName, principal, desc);
httpResp = resp;
- this.status = status;
+ this.status = status;
wasFailed = true; // if Trust Principal added, must be good
}
public RESP authenticate() throws IOException {
- httpResp.setStatus(401); // Unauthorized
+ httpResp.setStatus(401); // Unauthorized
return RESP.HTTP_REDIRECT_INVOKED;
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Lur.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Lur.java
index 1a1adcc5..2c5c93d2 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Lur.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Lur.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@ public class OAuth2Lur implements Lur {
public OAuth2Lur(TokenMgr tm) {
this.tm = tm;
}
-
+
@Override
public Permission createPerm(String p) {
String[] params = Split.split('|', p);
@@ -54,12 +54,12 @@ public class OAuth2Lur implements Lur {
@Override
public boolean fish(Principal bait, Permission ... pond) {
boolean rv = false;
-
+
if (bait instanceof OAuth2Principal) {
- OAuth2Principal oap = (OAuth2Principal)bait;
+ OAuth2Principal oap = (OAuth2Principal)bait;
for (Permission p : pond ) {
AAFPermission apond = (AAFPermission)p;
-
+
TokenPerm tp = oap.tokenPerm();
if (tp==null) {
} else {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Principal.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Principal.java
index 86475d53..6d07219d 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Principal.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Principal.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,17 +26,17 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
public class OAuth2Principal extends TaggedPrincipal {
private TokenPerm tp;
// private byte[] hash; // hashed cred for disk validation
-
+
public OAuth2Principal(TokenPerm tp, byte[] hash) {
this.tp = tp;
// this.hash = hash;
}
-
+
@Override
public String getName() {
return tp.getUsername();
}
-
+
public TokenPerm tokenPerm() {
return tp;
}
@@ -50,5 +50,5 @@ public class OAuth2Principal extends TaggedPrincipal {
public String personalName() {
return tp.getUsername();
}
-
+
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TimedToken.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TimedToken.java
index 38accc7a..81fee11d 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TimedToken.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TimedToken.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,16 +33,16 @@ import aafoauth.v2_0.Token;
* TimedToken
* Tokens come from the Token Server with an "Expired In" setting. This class will take that, and
* create a date from time of Creation, which works with local code.
- *
+ *
* We create a Derived class, so that it can be used as is the originating Token type.
- *
- * "expired" is local computer time
+ *
+ * "expired" is local computer time
* @author Jonathan
*
*/
// Package on purpose
public class TimedToken extends Token implements Persistable<Token> {
- private Persisting<Token> cacheable; // no double inheritance...
+ private Persisting<Token> cacheable; // no double inheritance...
// public TimedToken(Token t, byte[] hash) {
// this(t,(System.currentTimeMillis()/1000)+t.getExpiresIn(),hash,null);
@@ -51,7 +51,7 @@ public class TimedToken extends Token implements Persistable<Token> {
public TimedToken(Persist<Token,?> p, Token t, byte[] hash, Path path){
this(p,t,t.getExpiresIn()+(System.currentTimeMillis()/1000),hash, path);
}
-
+
public TimedToken(Persist<Token,?> p, Token t, long expires_secsFrom1970, byte[] hash, Path path) {
cacheable = new Persisting<Token>(p, t,expires_secsFrom1970, hash, path);
accessToken=t.getAccessToken();
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClient.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClient.java
index 58ecaa84..0ebd8acc 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClient.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -85,18 +85,18 @@ public class TokenClient {
introspectDF = tkCon.env().newDataFactory(Introspect.class);
}
}
-
+
}
public void client_id(String client_id) {
this.client_id = client_id;
default_scope = FQI.reverseDomain(client_id);
}
-
+
public String client_id() {
return client_id;
}
-
+
/**
* This scope based on client_id... the App configured for call
* @return
@@ -121,9 +121,9 @@ public class TokenClient {
/**
* Note: OAuth2 provides for normal Authentication parameters when getting tokens. Basic Auth is one such valid
* way to get Credentials. However, support is up to the OAuth2 Implementation
- *
+ *
* This method is for setting an App's creds (client) to another App.
- *
+ *
* @param client_id
* @param client_secret
* @throws IOException
@@ -170,13 +170,13 @@ public class TokenClient {
return con.x509Alias(client_id);// no password, assume Cert
} catch (APIException e) {
throw new CadiException(e);
- }
- }
+ }
+ }
};
authn_method = AUTHN_METHOD.client_credentials;
}
}
-
+
public void username(String username) {
this.username = username;
}
@@ -184,9 +184,9 @@ public class TokenClient {
/**
* Note: OAuth2 provides for normal Authentication parameters when getting tokens. Basic Auth is one such valid
* way to get Credentials. However, support is up to the OAuth2 Implementation
- *
+ *
* This method is for setting the End-User's Creds
- *
+ *
* @param client_id
* @param client_secret
* @throws IOException
@@ -222,7 +222,7 @@ public class TokenClient {
}
}
}
-
+
public void clearEndUser() {
username = null;
enc_password = null;
@@ -254,9 +254,9 @@ public class TokenClient {
}
/**
* Get AuthToken
- * @throws APIException
- * @throws CadiException
- * @throws LocatorException
+ * @throws APIException
+ * @throws CadiException
+ * @throws LocatorException
*/
public Result<TimedToken> getToken(final char kind, final String ... scopes) throws LocatorException, CadiException, APIException {
final String scope = addScope(scopes);
@@ -270,14 +270,14 @@ public class TokenClient {
if (ss==null) {
throw new APIException("client_creds(...) must be set before obtaining Access Tokens");
}
-
+
Result<TimedToken> rtt = factory.get(key,hash,new Loader<TimedToken>() {
@Override
public Result<TimedToken> load(final String key) throws APIException, CadiException, LocatorException {
final List<String> params = new ArrayList<>();
params.add(scope);
addSecurity(params,authn_method);
-
+
final String paramsa[] = new String[params.size()];
params.toArray(paramsa);
Result<Token> rt = tkCon.best(new Retryable<Result<Token>>() {
@@ -292,7 +292,7 @@ public class TokenClient {
}
}
});
-
+
if (rt.isOK()) {
try {
return Result.ok(rt.code,factory.putTimedToken(key,rt.value, hash));
@@ -326,7 +326,7 @@ public class TokenClient {
}
return Result.err(404,"Not Found");
}
-
+
public Result<TimedToken> refreshToken(Token token) throws APIException, LocatorException, CadiException {
if (ss==null) {
throw new APIException("client_creds(...) must be set before obtaining Access Tokens");
@@ -336,7 +336,7 @@ public class TokenClient {
addSecurity(params,AUTHN_METHOD.refresh_token);
final String scope="scope="+token.getScope().replace(' ', '+');
params.add(scope);
-
+
final String paramsa[] = new String[params.size()];
params.toArray(paramsa);
Result<Token> rt = tkCon.best(new Retryable<Result<Token>>() {
@@ -389,7 +389,7 @@ public class TokenClient {
}
);
}
-
+
private String addScope(String[] scopes) {
String rv = null;
StringBuilder scope=null;
@@ -428,14 +428,14 @@ public class TokenClient {
// Nothing to do
break;
}
-
- // Set Credentials appropriate
+
+ // Set Credentials appropriate
switch(authn_method) {
case client_credentials:
if (client_id!=null) {
params.add("client_id="+client_id);
}
-
+
if (enc_client_secret!=null) {
try {
params.add("client_secret="+URLEncoder.encode(new String(factory.symm.decode(enc_client_secret)),UTF_8));
@@ -443,7 +443,7 @@ public class TokenClient {
throw new APIException("Error Decrypting Password",e);
}
}
-
+
if (username!=null) {
params.add("username="+username);
}
@@ -453,7 +453,7 @@ public class TokenClient {
if (client_id!=null) {
params.add("client_id="+client_id);
}
-
+
if (enc_client_secret!=null) {
try {
params.add("client_secret="+URLEncoder.encode(new String(factory.symm.decode(enc_client_secret)),UTF_8));
@@ -467,7 +467,7 @@ public class TokenClient {
if (client_id!=null) {
params.add("client_id="+client_id);
}
-
+
if (enc_client_secret!=null) {
try {
params.add("client_secret="+ URLEncoder.encode(new String(factory.symm.decode(enc_client_secret)),UTF_8));
@@ -478,7 +478,7 @@ public class TokenClient {
if (username!=null) {
params.add("username="+username);
}
-
+
if (enc_password!=null) {
try {
params.add("password="+ URLEncoder.encode(new String(factory.symm.decode(enc_password)),UTF_8));
@@ -486,7 +486,7 @@ public class TokenClient {
throw new APIException("Error Decrypting Password",e);
}
}
-
+
break;
default:
// Nothing to do
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java
index 8c47b6cb..6d2fd7fc 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -65,18 +65,18 @@ public class TokenClientFactory extends Persist<Token,TimedToken> {
private TokenClientFactory(Access pa) throws APIException, GeneralSecurityException, IOException, CadiException {
super(pa, new RosettaEnv(pa.getProperties()),Token.class,"outgoing");
-
+
Map<String, String> aaf_urls = Agent.loadURLs(pa);
alts = new TreeSet<>();
-
+
if (access.getProperty(Config.AAF_OAUTH2_TOKEN_URL,null)==null) {
access.getProperties().put(Config.AAF_OAUTH2_TOKEN_URL, aaf_urls.get(Config.AAF_OAUTH2_TOKEN_URL)); // Default to AAF
}
-
+
if (access.getProperty(Config.AAF_OAUTH2_INTROSPECT_URL,null)==null) {
access.getProperties().put(Config.AAF_OAUTH2_INTROSPECT_URL, aaf_urls.get(Config.AAF_OAUTH2_INTROSPECT_URL)); // Default to AAF);
}
-
+
for(String tag : new String[] {Config.AAF_ALT_OAUTH2_TOKEN_URL, Config.AAF_ALT_OAUTH2_INTROSPECT_URL}) {
String value = access.getProperty(tag, null);
if(value!=null) {
@@ -84,21 +84,21 @@ public class TokenClientFactory extends Persist<Token,TimedToken> {
alts.add(value);
}
}
-
+
symm = Symm.encrypt.obtain();
hsi = SecurityInfoC.instance(access, HttpURLConnection.class);
}
-
+
public synchronized static final TokenClientFactory instance(Access access) throws APIException, GeneralSecurityException, IOException, CadiException {
if (instance==null) {
instance = new TokenClientFactory(access);
}
return instance;
}
-
+
/**
* Pickup Timeout from Properties
- *
+ *
* @param tagOrURL
* @return
* @throws CadiException
@@ -108,7 +108,7 @@ public class TokenClientFactory extends Persist<Token,TimedToken> {
public<INTR> TokenClient newClient(final String tagOrURL) throws CadiException, LocatorException, APIException {
return newClient(tagOrURL,Integer.parseInt(access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF)));
}
-
+
public<INTR> TokenClient newClient(final String tagOrURL, final int timeout) throws CadiException, LocatorException, APIException {
AAFConHttp ach;
if (tagOrURL==null) {
@@ -134,7 +134,7 @@ public class TokenClientFactory extends Persist<Token,TimedToken> {
tci.client_creds(access);
return tci;
}
-
+
public TzClient newTzClient(final String locatorURL) throws CadiException, LocatorException {
try {
return new TzHClient(access,hsi,bestLocator(locatorURL));
@@ -180,7 +180,7 @@ public class TokenClientFactory extends Persist<Token,TimedToken> {
put(key,tt);
return tt;
}
-
+
private static final Pattern locatePattern = Pattern.compile("https://.*/locate/.*");
public Locator<URI> bestLocator(final String locatorURL ) throws LocatorException, URISyntaxException {
if (locatorURL==null) {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenMgr.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenMgr.java
index 5a4e7f0c..89d5c1a0 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenMgr.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenMgr.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -51,7 +51,7 @@ public class TokenMgr extends Persist<Introspect, TokenPerm> {
public static RosettaDF<Introspect> introspectDF;
private final TokenPermLoader tpLoader;
-
+
private TokenMgr(PropAccess access, String tokenURL, String introspectURL) throws APIException, CadiException {
super(access,new RosettaEnv(access.getProperties()),Introspect.class,"introspect");
synchronized(access) {
@@ -99,7 +99,7 @@ public class TokenMgr extends Persist<Introspect, TokenPerm> {
}
return tm;
}
-
+
public Result<OAuth2Principal> toPrincipal(final String accessToken, final byte[] hash) throws APIException, CadiException, LocatorException {
Result<TokenPerm> tp = get(accessToken, hash, new Loader<TokenPerm>() {
@Override
@@ -117,14 +117,14 @@ public class TokenMgr extends Persist<Introspect, TokenPerm> {
return Result.err(tp);
}
}
-
+
public Result<TokenPerm> get(final String accessToken, final byte[] hash) throws APIException, CadiException, LocatorException {
return get(accessToken,hash,new Loader<TokenPerm>() {
@Override
public Result<TokenPerm> load(String key) throws APIException, CadiException, LocatorException {
return tpLoader.load(key,hash);
}
-
+
});
// return tpLoader.load(accessToken,hash);
}
@@ -132,7 +132,7 @@ public class TokenMgr extends Persist<Introspect, TokenPerm> {
public interface TokenPermLoader{
public Result<TokenPerm> load(final String accessToken, final byte[] cred) throws APIException, CadiException, LocatorException;
}
-
+
private class RemoteTokenPermLoader implements TokenPermLoader {
private TokenClientFactory tcf;
private TokenClient tokenCL, introCL;
@@ -141,12 +141,12 @@ public class TokenMgr extends Persist<Introspect, TokenPerm> {
try {
tcf = TokenClientFactory.instance(access);
int timeout = Integer.parseInt(access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF));
- tokenCL = tcf.newClient(tokenURL,
+ tokenCL = tcf.newClient(tokenURL,
timeout);
if (introspectURL.equals(tokenURL)) {
introCL = tokenCL;
} else {
- introCL = tcf.newClient(introspectURL,
+ introCL = tcf.newClient(introspectURL,
timeout);
}
@@ -154,7 +154,7 @@ public class TokenMgr extends Persist<Introspect, TokenPerm> {
throw new CadiException(e);
}
}
-
+
public Result<TokenPerm> load(final String accessToken, final byte[] cred) throws APIException, CadiException, LocatorException {
long start = System.currentTimeMillis();
try {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenPerm.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenPerm.java
index 6efd9ce3..23153c28 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenPerm.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenPerm.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -62,23 +62,23 @@ public class TokenPerm extends Persisting<Introspect>{
}
scopes = ti.getScope();
}
-
+
public List<AAFPermission> perms() {
return perms;
}
-
+
public String getClientId() {
return introspect.getClientId();
}
-
+
public String getUsername() {
return introspect.getUsername();
}
-
+
public String getToken() {
return introspect.getAccessToken();
}
-
+
public synchronized String getScopes() {
return scopes;
}
@@ -86,7 +86,7 @@ public class TokenPerm extends Persisting<Introspect>{
public Introspect getIntrospect() {
return introspect;
}
-
+
// Direct Parse Perms into List
public static class LoadPermissions {
public List<AAFPermission> perms;
@@ -138,7 +138,7 @@ public class TokenPerm extends Persisting<Introspect>{
}
}
}
-
+
// Gathering object for parsing objects, then creating AAF Permission
private static class PermInfo {
public String ns,type,instance,action;
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzClient.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzClient.java
index 1ebbe877..2afc4b5e 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzClient.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,7 +30,7 @@ import org.onap.aaf.misc.env.APIException;
/**
* TimedToken Client
- *
+ *
* @author Jonathan
*
*/
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzHClient.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzHClient.java
index c07332d1..241abf41 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzHClient.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzHClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,7 +40,7 @@ import org.onap.aaf.misc.env.APIException;
/**
* Tokenized HClient
- *
+ *
* @author Jonathan
*
*/
@@ -62,7 +62,7 @@ public class TzHClient extends TzClient {
si = hsi;
hman = new HMangr(access, loc);
}
-
+
public void setToken(final String client_id, TimedToken token) throws IOException {
this.token = token;
tokenSS = new HTokenSS(si, client_id, token.getAccessToken());
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/obasic/OBasicHttpTaf.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/obasic/OBasicHttpTaf.java
index 4ae8ba5f..0f3b4587 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/obasic/OBasicHttpTaf.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/obasic/OBasicHttpTaf.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -55,31 +55,31 @@ import org.onap.aaf.misc.env.util.Pool.Pooled;
/**
* BasicHttpTaf
- *
- * This TAF implements the "Basic Auth" protocol.
- *
- * WARNING! It is true for any implementation of "Basic Auth" that the password is passed unencrypted.
- * This is because the expectation, when designed years ago, was that it would only be used in
+ *
+ * This TAF implements the "Basic Auth" protocol.
+ *
+ * WARNING! It is true for any implementation of "Basic Auth" that the password is passed unencrypted.
+ * This is because the expectation, when designed years ago, was that it would only be used in
* conjunction with SSL (https). It is common, however, for users to ignore this on the assumption that
* their internal network is secure, or just ignorance. Therefore, a WARNING will be printed
* when the HTTP Channel is not encrypted (unless explicitly turned off).
- *
+ *
* @author Jonathan
*
*/
public class OBasicHttpTaf extends AbsOTafLur implements HttpTaf {
private final String realm;
private final CredVal rbac;
-
-
+
+
public OBasicHttpTaf(final PropAccess access, final CredVal rbac, final String realm, final String token_url, final String introspect_url) throws CadiException {
super(access, token_url,introspect_url);
this.rbac = rbac;
this.realm = realm;
}
-
+
/**
- * Note: BasicHttp works for either Carbon Based (Humans) or Silicon Based (machine) Lifeforms.
+ * Note: BasicHttp works for either Carbon Based (Humans) or Silicon Based (machine) Lifeforms.
* @see Taf
*/
public TafResp validate(Taf.LifeForm reading, HttpServletRequest req, HttpServletResponse resp) {
@@ -109,7 +109,7 @@ public class OBasicHttpTaf extends AbsOTafLur implements HttpTaf {
return new BasicHttpTafResp(access,user,"Malformed BasicAuth entry",RESP.FAIL,resp,realm,false);
}
if (!rbac.validate(user,Type.PASSWORD,password.getBytes(),req)) {
- return new BasicHttpTafResp(access,user,buildMsg(null,req,"user/pass combo invalid for ",user,"from",req.getRemoteAddr()),
+ return new BasicHttpTafResp(access,user,buildMsg(null,req,"user/pass combo invalid for ",user,"from",req.getRemoteAddr()),
RESP.TRY_AUTHENTICATING,resp,realm,true);
}
} catch (IOException e) {
@@ -150,13 +150,13 @@ public class OBasicHttpTaf extends AbsOTafLur implements HttpTaf {
}
} finally {
pclient.done();
- }
+ }
} catch (APIException | CadiException | LocatorException | NoSuchAlgorithmException e) {
access.log(e, ERROR_GETTING_TOKEN_CLIENT);
return new BasicHttpTafResp(access,user,ERROR_GETTING_TOKEN_CLIENT,RESP.TRY_ANOTHER_TAF,resp,realm,false);
}
}
-
+
protected String buildMsg(Principal pr, HttpServletRequest req, Object ... msg) {
StringBuilder sb = new StringBuilder();
if (pr!=null) {
@@ -189,7 +189,7 @@ public class OBasicHttpTaf extends AbsOTafLur implements HttpTaf {
// }
return Resp.NOT_MINE;
}
-
+
public String toString() {
return "Basic Auth enabled on realm: " + realm;
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/olur/OLur.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/olur/OLur.java
index b85e311d..5b78585d 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/olur/OLur.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/olur/OLur.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -62,7 +62,7 @@ public class OLur extends AbsOTafLur implements Lur {
} else {
tp=null;
}
- if (tp==null) {
+ if (tp==null) {
// if no Token Perm preset, get
try {
Pooled<TokenClient> tcp = tokenClientPool.get();
@@ -80,7 +80,7 @@ public class OLur extends AbsOTafLur implements Lur {
}
String[] scopes = new String[scopeSet.size()];
scopeSet.toArray(scopes);
-
+
Result<TimedToken> rtt = tc.getToken(Kind.getKind(bait),scopes);
if (rtt.isOK()) {
Result<TokenPerm> rtp = tkMgr.get(rtt.value.getAccessToken(), bait.getName().getBytes());
@@ -95,18 +95,18 @@ public class OLur extends AbsOTafLur implements Lur {
access.log(e, "Unable to Get a Token");
}
}
-
+
boolean rv = false;
if (tp!=null) {
if (tkMgr.access.willLog(Level.DEBUG)) {
StringBuilder sb = new StringBuilder("AAF Permissions for user ");
sb.append(bait.getName());
- sb.append(", from token ");
+ sb.append(", from token ");
sb.append(tp.get().getAccessToken());
for (AAFPermission p : tp.perms()) {
sb.append("\n\t[");
sb.append(p.getNS());
- sb.append(']');
+ sb.append(']');
sb.append(p.getType());
sb.append('|');
sb.append(p.getInstance());
@@ -139,7 +139,7 @@ public class OLur extends AbsOTafLur implements Lur {
for (AAFPermission p : ((OAuth2Principal)bait).tokenPerm().perms()) {
permissions.add(p);
}
- }
+ }
}
/* (non-Javadoc)
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java
index 472bb529..ea539271 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -55,12 +55,12 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
// store all the directories to review
// No Concurrent HashSet, or at least, it is all implemented with HashMap in older versions
private static Queue<Persist<?,?>> allPersists = new ConcurrentLinkedQueue<Persist<?,?>>();
-
+
private Map<String,CT> tmap;
protected RosettaEnv env;
private RosettaDF<T> df;
-
+
public Persist(Access access, RosettaEnv env, Class<T> cls, String sub_dir) throws CadiException, APIException {
super(access, sub_dir);
this.env = env;
@@ -74,11 +74,11 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
}
allPersists.add(this);
}
-
+
public void close() {
allPersists.remove(this);
}
-
+
protected abstract CT newCacheable(T t, long expires_secsFrom1970, byte[] hash, Path path) throws APIException, IOException;
public RosettaDF<T> getDF() {
@@ -113,7 +113,7 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
access.log(e,"Reading Token from",key);
}
} // if not read, then ct still==null
-
+
// If not in memory, or on disk, get from Remote... IF reloadable (meaning, isn't hitting too often, etc).
if (ct==null || ct.checkReloadable()) {
// Load from external (if makes sense)
@@ -133,7 +133,7 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
return Result.err(rtp);
}
}
-
+
if (ct!=null) {
tmap.put(key, ct);
}
@@ -149,39 +149,39 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
writeDisk(df, ct.get(), ct.getHash(), key, ct.expires());
tmap.put(key,ct);
}
-
+
public void delete(String key) {
tmap.remove(key);
deleteFromDisk(key);
}
public interface Loader<CT> {
- Result<CT> load(String key) throws APIException, CadiException, LocatorException;
+ Result<CT> load(String key) throws APIException, CadiException, LocatorException;
}
/**
* Clean will examine resources, and remove those that have expired.
- *
+ *
* If "highs" have been exceeded, then we'll expire 10% more the next time. This will adjust after each run
* without checking contents more than once, making a good average "high" in the minimum speed.
- *
+ *
* @author Jonathan
*
*/
private static final class Clean extends TimerTask {
private final Access access;
private long hourly;
-
+
public Clean(Access access) {
this.access = access;
hourly=0;
}
-
+
private static class Metrics {
public int mexists = 0, dexists=0;
public int mremoved = 0, dremoved=0;
}
-
+
public void run() {
final long now = System.currentTimeMillis();
final long dayFromNow = now + ONE_DAY;
@@ -203,7 +203,7 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
p.clearCount();
}
} else if (Files.exists(p.path())) {
-
+
}
}
// Clear disk
@@ -246,7 +246,7 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
sb.append(e.getMessage());
++metrics.dremoved;
}
-
+
}
return FileVisitResult.CONTINUE;
}
@@ -262,14 +262,14 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
access.log(Level.DEBUG, sb);
return FileVisitResult.CONTINUE;
}
-
+
});
} catch (IOException e) {
access.log(e, "Exception while cleaning Persistance");
}
-
+
}
-
+
// We want to print some activity of Persistence Check at least hourly, even if no activity has occurred, but not litter the log if nothing is happening
boolean go=false;
Level level=Level.WARN;
@@ -279,9 +279,9 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
} else if (access.willLog(Level.WARN)) {
go = metrics.mremoved>0 || metrics.dremoved>0 || --hourly <= 0;
}
-
+
if (go) {
- access.printf(level, "Persist Cache: removed %d of %d items from memory and %d of %d from disk",
+ access.printf(level, "Persist Cache: removed %d of %d items from memory and %d of %d from disk",
metrics.mremoved, metrics.mexists, metrics.dremoved, metrics.dexists);
hourly = 3600000/CLEAN_CHECK;
}
@@ -296,6 +296,6 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
close(); // can call twice.
}
-
+
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/PersistFile.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/PersistFile.java
index c7d71488..db9852ec 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/PersistFile.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/PersistFile.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,13 +52,13 @@ public class PersistFile {
private static final String HASH_NO_MATCH = "Hash does not match in Persistence";
private static final Object LOCK = new Object();
-
+
protected static Symm symm;
public Access access;
protected final Path tokenPath;
protected final String tokenDir;
private static final boolean isWindows = System.getProperty("os.name").startsWith("Windows");
-
+
public PersistFile(Access access, String sub_dir) throws CadiException, APIException {
this.access = access;
tokenPath = Paths.get(access.getProperty(Config.CADI_TOKEN_DIR,"tokens"), sub_dir);
@@ -112,7 +112,7 @@ public class PersistFile {
}
df.newData().load(t).to(os);
} finally {
- // Note: Someone on the Web noticed that using a DataOutputStream would not full close out without a flush first,
+ // Note: Someone on the Web noticed that using a DataOutputStream would not full close out without a flush first,
// leaving files open.
try {
os.flush();
@@ -146,7 +146,7 @@ public class PersistFile {
}
return readDisk(df,cred,hp.get(),hl);
}
-
+
public <T> T readDisk(final RosettaDF<T> df, final byte[] cred, final Path target, final Holder<Long> hexpired) throws CadiException {
// Try from Disk
T t = null;
@@ -160,7 +160,7 @@ public class PersistFile {
exp |= ((long)is.read()<<i);
}
hexpired.set(exp);
-
+
t = symm.exec(new Symm.SyncExec<T>() {
@Override
public T exec(Encryption enc) throws Exception {
@@ -194,7 +194,7 @@ public class PersistFile {
} finally {
is.close();
}
- } catch (NoSuchFileException e) {
+ } catch (NoSuchFileException e) {
return t;
} catch (Exception e) {
throw new CadiException(e);
@@ -202,7 +202,7 @@ public class PersistFile {
}
return t;
}
-
+
public long readExpiration(final Path target) throws CadiException {
long exp=0L;
if (Files.exists(target)) {
@@ -243,7 +243,7 @@ public class PersistFile {
public Path getPath(String filename) {
return Paths.get(tokenDir,filename);
}
-
+
public FileTime getFileTime(String filename, Holder<Path> hp) throws IOException {
Path p = hp.get();
if (p==null) {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persistable.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persistable.java
index 1f22028b..3fceb6f6 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persistable.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persistable.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persisting.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persisting.java
index bde60777..55b013e3 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persisting.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persisting.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,7 +41,7 @@ public class Persisting<T> implements Persistable<T> {
private T t;
private Path path;
private Persist<T, ?> persist;
-
+
public Persisting(Persist<T,?> p, T t, long expiresSecsFrom1970, byte[] hash, Path path) {
persist = p;
this.t=t;
@@ -110,7 +110,7 @@ public class Persisting<T> implements Persistable<T> {
*/
@Override
public boolean checkReloadable() {
- //TODO other elements to add here...
+ //TODO other elements to add here...
// Ideas: Is it valid?
// if not, How many times has it been checked in the last minute
return expired();
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrant.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrant.java
index 4bbe5ff9..fea6c1bd 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrant.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrant.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrar.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrar.java
index 18eb7357..4555171b 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrar.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrar.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,8 +43,8 @@ public class Registrar<ENV extends BasicEnv> {
erroringTimer = null;
timer = new Timer(REGISTRAR,true);
- timer.schedule(new RegistrationTimerTask(env), START, INTERVAL);
-
+ timer.schedule(new RegistrationTimerTask(env), START, INTERVAL);
+
if (shutdownHook) {
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
@@ -53,7 +53,7 @@ public class Registrar<ENV extends BasicEnv> {
});
}
}
-
+
private class RegistrationTimerTask extends TimerTask {
private final ENV env;
public RegistrationTimerTask(ENV env) {
@@ -82,11 +82,11 @@ public class Registrar<ENV extends BasicEnv> {
}
}
}
-
+
public void register(Registrant<ENV> r) {
registrants.addLast(r);
}
-
+
public void deregister(Registrant<ENV> r) {
registrants.remove(r);
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java
index 80fc1a4f..de006ae2 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,11 +37,11 @@ import locate.v1_0.MgmtEndpoints;
public class RegistrationCreator {
private Access access;
-
+
public RegistrationCreator(Access access) {
this.access = access;
}
-
+
public MgmtEndpoints create(final int port) throws CadiException {
MgmtEndpoints me = new MgmtEndpoints();
List<MgmtEndpoint> lme = me.getMgmtEndpoint();
@@ -52,9 +52,9 @@ public class RegistrationCreator {
String dot_le;
String version=null;
String defProtocol="https";
-
+
RegistrationPropHolder ph = new RegistrationPropHolder(access, port);
-
+
String firstPrivateHostname = null;
// Now, loop through by Container
for(String le : Split.splitTrim(',', ph.lcontainer)) {
@@ -72,7 +72,7 @@ public class RegistrationCreator {
locate.setProtocol(defProtocol = access.getProperty(Config.AAF_LOCATOR_PROTOCOL,defProtocol));
List<String> ls = locate.getSubprotocol();
for(String sp : Split.splitTrim(',', access.getProperty(Config.AAF_LOCATOR_SUBPROTOCOL,""))) {
- ls.add(sp);
+ ls.add(sp);
}
locate.setLatitude(ph.latitude);
locate.setLongitude(ph.longitude);
@@ -80,27 +80,27 @@ public class RegistrationCreator {
} else {
locate = copy(defData);
}
-
+
locate.setName(ph.getEntryName(entry,dot_le));
/* Cover the situation where there is a Container, and multiple locator Entries,
* the first of which is the only real private FQDN
* example: oauth
* aaf_locator_entries=oauth,token,introspect
- *
+ *
* Entries for token and introspect, but they point to oauth service.
*/
String locateHostname;
- if(le.isEmpty()) {
+ if(le.isEmpty()) {
locateHostname=ph.getEntryFQDN(entry, dot_le);
} else if(firstPrivateHostname==null) {
firstPrivateHostname=locateHostname=ph.getEntryFQDN(entry, dot_le);
} else {
locateHostname=firstPrivateHostname;
}
-
+
locate.setHostname(locateHostname);
locate.setPort(ph.getEntryPort(dot_le));
-
+
String specificVersion = access.getProperty(Config.AAF_LOCATOR_VERSION + dot_le,null);
if(specificVersion == null && locate == defData) {
specificVersion = version;
@@ -142,13 +142,13 @@ public class RegistrationCreator {
} catch (NumberFormatException | UnknownHostException e) {
throw new CadiException("Error extracting Data from Properties for Registrar",e);
}
-
+
if(access.willLog(Level.INFO)) {
access.log(Level.INFO, print(new StringBuilder(),me.getMgmtEndpoint()));
}
return me;
}
-
+
/*
* Find the best version between Actual Interface and Deployed version
*/
@@ -165,8 +165,8 @@ public class RegistrationCreator {
break;
}
}
- }
-
+ }
+
if(sb.length()==0 && deploy.length>i) {
s=deploy[i];
for(int j=0;j<s.length();++j) {
@@ -177,7 +177,7 @@ public class RegistrationCreator {
}
}
}
-
+
return sb.length()==0?0:Integer.parseInt(sb.toString());
}
@@ -242,7 +242,7 @@ public class RegistrationCreator {
out.append(s);
}
}
-
+
private MgmtEndpoint copy(MgmtEndpoint mep) {
MgmtEndpoint out = new MgmtEndpoint();
out.setName(mep.getName());
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java
index b49b911b..49af80fd 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -79,11 +79,11 @@ public class RemoteRegistrant<ENV extends BasicEnv> implements Registrant<ENV> {
throw new CadiException(e);
}
}
-
+
RegistrationCreator rcreator = new RegistrationCreator(access);
meps = rcreator.create(port);
}
-
+
@Override
@@ -103,7 +103,7 @@ public class RemoteRegistrant<ENV extends BasicEnv> implements Registrant<ENV> {
access.log(e, "Error registering service to AAF Locator");
return Result.err(503,e.getMessage());
}
-
+
} catch (CadiException e) {
return Result.err(503,e.getMessage());
}
@@ -125,7 +125,7 @@ public class RemoteRegistrant<ENV extends BasicEnv> implements Registrant<ENV> {
access.log(e, "Error deregistering service on AAF Locator");
return Result.err(503,e.getMessage());
}
-
+
} catch (CadiException e) {
return Result.err(503,e.getMessage());
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java
index c9b21b2a..a6a74103 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java
@@ -83,7 +83,7 @@ public class AAFSSO {
public AAFSSO(String[] args) throws IOException, CadiException {
this(args,new Properties());
}
-
+
public AAFSSO(String[] args, ProcessArgs pa) throws IOException, CadiException {
this(args,pa.process(args, new Properties()));
}
@@ -114,7 +114,7 @@ public class AAFSSO {
propStream.close();
}
}
-
+
File dot_aaf_kf = new File(dot_aaf, "keyfile");
if (removeSSO) {
@@ -143,7 +143,7 @@ public class AAFSSO {
System.out.println("AAF SSO information removed");
} else {
// Config.setDefaultRealm(access);
-
+
if (!dot_aaf_kf.exists()) {
// This will create, as required, or reuse
ArtifactDir.getSymm(dot_aaf_kf);
@@ -155,9 +155,9 @@ public class AAFSSO {
String[] naargs = new String[nargs.size()];
nargs.toArray(naargs);
access = new PropAccess(os, naargs);
-
+
if (loginOnly) {
- for (String tag : new String[] {Config.AAF_APPID, Config.AAF_APPPASS,
+ for (String tag : new String[] {Config.AAF_APPID, Config.AAF_APPPASS,
Config.CADI_ALIAS, Config.CADI_KEYSTORE,Config.CADI_KEYSTORE_PASSWORD,Config.CADI_KEY_PASSWORD}) {
access.getProperties().remove(tag);
diskprops.remove(tag);
@@ -171,14 +171,14 @@ public class AAFSSO {
// }
// touchDiskprops=true;
}
-
+
String keyfile = access.getProperty(Config.CADI_KEYFILE); // in case its CertificateMan props
if (keyfile == null) {
access.setProperty(Config.CADI_KEYFILE, dot_aaf_kf.getAbsolutePath());
addProp(Config.CADI_KEYFILE,dot_aaf_kf.getAbsolutePath());
}
-
-
+
+
String alias, appID;
alias = access.getProperty(Config.CADI_ALIAS);
if (alias==null) {
@@ -188,7 +188,7 @@ public class AAFSSO {
user=alias;
appID=null;
}
-
+
String aaf_container_ns = "";
if (appID!=null) {
if( access.getProperty(Config.AAF_APPPASS)==null) {
@@ -204,10 +204,10 @@ public class AAFSSO {
}
diskprops.setProperty(Config.AAF_APPID,appID);
}
-
+
String keystore=access.getProperty(Config.CADI_KEYSTORE);
String keystore_pass=access.getProperty(Config.CADI_KEYSTORE_PASSWORD);
-
+
if (user==null || (alias!=null && (keystore==null || keystore_pass==null))) {
String select = null;
String name;
@@ -224,7 +224,7 @@ public class AAFSSO {
encrypted_pass= access.encrypt(new String(password));
access.setProperty(Config.CADI_KEYSTORE_PASSWORD, encrypted_pass);
addProp(Config.CADI_KEYSTORE_PASSWORD, encrypted_pass);
-
+
// TODO READ Aliases out of Keystore?
user = alias = cons.readLine("Keystore alias: ");
access.setProperty(Config.CADI_ALIAS, user);
@@ -251,8 +251,8 @@ public class AAFSSO {
keystore_pass = encrypted_pass;
}
}
-
-
+
+
if (alias!=null) {
use_X509 = true;
} else {
@@ -302,7 +302,7 @@ public class AAFSSO {
if (user == null) {
err = new StringBuilder("Add -D" + Config.AAF_APPID + "=<id> ");
}
-
+
if (encrypted_pass == null && alias == null) {
if (err == null) {
err = new StringBuilder();
@@ -311,7 +311,7 @@ public class AAFSSO {
}
err.append("-D" + Config.AAF_APPPASS + "=<passwd> ");
}
-
+
String cadiLatitude = access.getProperty(Config.CADI_LATITUDE);
if (cadiLatitude==null) {
System.out.println("# If you do not know your Global Coordinates, we suggest bing.com/maps");
@@ -321,7 +321,7 @@ public class AAFSSO {
}
access.setProperty(Config.CADI_LATITUDE, cadiLatitude);
addProp(Config.CADI_LATITUDE, cadiLatitude);
-
+
}
String cadiLongitude = access.getProperty(Config.CADI_LONGITUDE);
if (cadiLongitude==null) {
@@ -332,14 +332,14 @@ public class AAFSSO {
access.setProperty(Config.CADI_LONGITUDE, cadiLongitude);
addProp(Config.CADI_LONGITUDE, cadiLongitude);
}
-
+
String cadi_truststore = access.getProperty(Config.CADI_TRUSTSTORE);
if (cadi_truststore==null) {
- String name;
+ String name;
String select;
for (File tsf : dot_aaf.listFiles()) {
name = tsf.getName();
- if (name.contains("trust") &&
+ if (name.contains("trust") &&
(name.endsWith(".jks") || name.endsWith(".p12"))) {
select = cons.readLine("Use %s for TrustStore? (y/n):",tsf.getName());
if ("y".equalsIgnoreCase(select)) {
@@ -401,7 +401,7 @@ public class AAFSSO {
access.log(e);
}
}
-
+
final String apiVersion = access.getProperty(Config.AAF_API_VERSION, Config.AAF_DEFAULT_API_VERSION);
final String aaf_root_ns = access.getProperty(Config.AAF_ROOT_NS);
String locateRoot;
@@ -521,7 +521,7 @@ public class AAFSSO {
}
return larg;
}
-
+
private void setReadonly(File file) {
file.setExecutable(false, false);
file.setWritable(false, false);
@@ -532,7 +532,7 @@ public class AAFSSO {
public boolean ok() {
return ok;
}
-
+
public static interface ProcessArgs {
public Properties process(final String[] args, final Properties props);
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/test/JU_ErrMessageTest.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/test/JU_ErrMessageTest.java
index b7dfec46..a58edc22 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/test/JU_ErrMessageTest.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/test/JU_ErrMessageTest.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,29 +44,29 @@ import org.onap.aaf.misc.rosetta.env.RosettaEnv;
import aaf.v2_0.Error;
public class JU_ErrMessageTest {
-
+
@Mock
private RosettaEnv env;
-
+
@Mock(answer=Answers.RETURNS_DEEP_STUBS)
private RosettaDF<Object> errDF;
private ErrMessage errMessage;
private String attErrJson = "key:value";
-
+
private Error error;
private Future<?> future;
private ByteArrayOutputStream errStream;
-
+
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
-
+
when(env.newDataFactory(Error.class)).thenReturn(errDF);
-
+
future = new Future<Error>() {
@Override
@@ -89,47 +89,47 @@ public class JU_ErrMessageTest {
return "header";
}
};
-
+
error = new Error();
error.setMessageId("Error Message Id");
error.setText("Error Text");
errMessage = new ErrMessage(env);
-
+
errStream = new ByteArrayOutputStream();
}
@Test
public void testPrintErrMessage() throws APIException {
when(errDF.newData().in(TYPE.JSON).load(attErrJson).asObject()).thenReturn(error);
-
+
errMessage.printErr(new PrintStream(errStream), attErrJson);
assertEquals("Error Message Id Error Text" + System.lineSeparator(), errStream.toString());
}
-
+
@Test
public void testToMsgJsonErrAttribute() throws APIException {
when(errDF.newData().in(TYPE.JSON).load(attErrJson).asObject()).thenReturn(error);
-
+
StringBuilder sb = new StringBuilder();
errMessage.toMsg(sb,attErrJson);
-
+
assertEquals(sb.toString(),"Error Message Id Error Text");
}
-
+
@Test
public void testToMsgFuture() {
StringBuilder sb = errMessage.toMsg(future);
-
+
assertEquals(sb.toString(), "0: Body");
}
-
+
@Test
public void testToMsgFutureWithoutException() throws APIException {
when(errDF.newData().in(TYPE.JSON).load(future.body()).asObject()).thenReturn(error);
-
+
StringBuilder sb = errMessage.toMsg(future);
-
+
assertEquals(sb.toString(), "Error Message Id Error Text");
}
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/JU_PermEval.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/JU_PermEval.java
index 5d242005..d39cbdb0 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/JU_PermEval.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/JU_PermEval.java
@@ -211,7 +211,7 @@ public class JU_PermEval {
@SuppressWarnings("unused")
PermEval pe = new PermEval();
}
-
+
@Test
public void pathTest() {
assertTrue(PermEval.evalInstance("/","/"));
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/TestHClient.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/TestHClient.java
index 5e642c67..18e72b4b 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/TestHClient.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/TestHClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -54,14 +54,14 @@ public class TestHClient {
for (Item item = loc.first(); item!=null; item=loc.next(item)) {
System.out.println(loc.get(item));
}
-
+
hman = new HMangr(access,loc);
final String path = String.format("/authz/perms/user/%s",
access.getProperty(Config.AAF_APPID,"xx9999@people.osaaf.org"));
hman.best(si.defSS, new Retryable<Void>() {
@Override
public Void code(Rcli<?> cli) throws APIException, CadiException {
- Future<String> ft = cli.read(path,"application/json");
+ Future<String> ft = cli.read(path,"application/json");
if (ft.get(10000)) {
System.out.println("Hurray,\n"+ft.body());
} else {
@@ -79,5 +79,5 @@ public class TestHClient {
e.printStackTrace();
}
}
-
+
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFAuthn.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFAuthn.java
index 7dccc8c1..51ed8de2 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFAuthn.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFAuthn.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -42,13 +42,13 @@ public class JU_AAFAuthn {
@Mock
AAFCon con;
-
+
@Mock
AbsUserCache<AAFPermission> cache;
-
+
@Mock
PropAccess propaccess;
-
+
@Before
public void setUp() {
initMocks(this);
@@ -60,7 +60,7 @@ public class JU_AAFAuthn {
String realm = authnObj.getRealm();
assertNull(realm);
}
-
+
@Test
public void testValidateFailure() {
AAFAuthnImplWithGetUserNull authnObj = new AAFAuthnImplWithGetUserNull(con, cache);
@@ -74,7 +74,7 @@ public class JU_AAFAuthn {
assertNull( e.getLocalizedMessage());
}
}
-
+
@Test
public void testValidate() {
AAFAuthnImpl authnObj = new AAFAuthnImpl(con);
@@ -93,7 +93,7 @@ public class JU_AAFAuthn {
e.printStackTrace();
}
}
-
+
@Test
public void testValidateRevalidate() {
AAFAuthnImpl authnObj = new AAFAuthnImpl(con);
@@ -113,7 +113,7 @@ public class JU_AAFAuthn {
e.printStackTrace();
}
}
-
+
@Test
public void testValidateValidUser() {
AAFAuthnImplWithGetUser authnObj = new AAFAuthnImplWithGetUser(con);
@@ -127,7 +127,7 @@ public class JU_AAFAuthn {
e.printStackTrace();
}
}
-
+
@Test
public void testValidateValidUserNull() {
AAFAuthnImplWithGetUserNull authnObj = new AAFAuthnImplWithGetUserNull(con);
@@ -147,48 +147,48 @@ public class JU_AAFAuthn {
this.access = propaccess;
// TODO Auto-generated constructor stub
}
-
+
AAFAuthnImpl(AAFCon con, AbsUserCache cache) {
super(con, cache);
this.access = propaccess;
// TODO Auto-generated constructor stub
}
-
-
+
+
}
-
+
class AAFAuthnImplWithGetUser extends AAFAuthn{
AAFAuthnImplWithGetUser(AAFCon con) {
super(con);
this.access = propaccess;
// TODO Auto-generated constructor stub
}
-
+
AAFAuthnImplWithGetUser(AAFCon con, AbsUserCache cache) {
super(con, cache);
this.access = propaccess;
// TODO Auto-generated constructor stub
}
-
+
@Override
protected User getUser(String user, byte[] cred) {
return new User<>("test",new byte[] {});
}
}
-
+
class AAFAuthnImplWithGetUserNull extends AAFAuthn{
AAFAuthnImplWithGetUserNull(AAFCon con) {
super(con);
this.access = propaccess;
// TODO Auto-generated constructor stub
}
-
+
AAFAuthnImplWithGetUserNull(AAFCon con, AbsUserCache cache) {
super(con, cache);
this.access = propaccess;
// TODO Auto-generated constructor stub
}
-
+
@Override
protected User getUser(String user, byte[] cred) {
User user1 = null;
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFSingleLocator.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFSingleLocator.java
index 89066c99..10b89485 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFSingleLocator.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFSingleLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,16 +44,16 @@ public class JU_AAFSingleLocator {
@Mock
AAFCon con;
-
+
@Mock
AbsUserCache<AAFPermission> cache;
-
+
@Mock
PropAccess propaccess;
-
+
AAFSingleLocator authnObj;
-
+
@Before
public void setUp() {
initMocks(this);
@@ -62,7 +62,7 @@ public class JU_AAFSingleLocator {
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
@Test
@@ -75,13 +75,13 @@ public class JU_AAFSingleLocator {
e.printStackTrace();
}
}
-
+
@Test
public void testHasItem() {
boolean retVal = authnObj.hasItems();
assertTrue(retVal);
}
-
+
@Test
public void testInvalidate() {
try {
@@ -91,7 +91,7 @@ public class JU_AAFSingleLocator {
e.printStackTrace();
}
}
-
+
@Test
public void testBest() {
try {
@@ -122,17 +122,17 @@ public class JU_AAFSingleLocator {
e.printStackTrace();
}
}
-
+
@Test
public void testRefres() {
boolean retVal = authnObj.refresh();
assertFalse(retVal);
}
-
+
@Test
public void testdestroy() {
authnObj.destroy();
}
-
-
+
+
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java
index c76d178f..37710138 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -56,43 +56,43 @@ import locate.v1_0.Endpoint;
import locate.v1_0.Endpoints;
public class JU_AAFLocator {
-
+
@Mock private HClient clientMock;
@Mock private Future<Endpoints> futureMock;
@Mock private Endpoints endpointsMock;
-
+
private PropAccess access;
-
+
private ByteArrayOutputStream errStream;
-
+
private static final String uriString = "https://example.com";
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
-
+
doReturn(futureMock).when(clientMock).futureRead((RosettaDF<?>)any(), eq(TYPE.JSON));
when(clientMock.timeout()).thenReturn(1);
when(clientMock.getURI()).thenReturn(new URI(uriString));
when(futureMock.get(1)).thenReturn(true);
-
+
futureMock.value = endpointsMock;
List<Endpoint> endpoints = new ArrayList<>();
endpoints.add(new Endpoint());
when(endpointsMock.getEndpoint()).thenReturn(endpoints);
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
-
+
errStream = new ByteArrayOutputStream();
System.setErr(new PrintStream(errStream));
}
-
+
@After
public void tearDown() {
System.setErr(System.err);
}
-
+
@AfterClass
public static void tearDownAfterClass() throws Exception {
Field field = SecurityInfoC.class.getDeclaredField("sicMap");
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AbsAAFLocator.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AbsAAFLocator.java
index 004eed3a..5f5858ce 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AbsAAFLocator.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AbsAAFLocator.java
@@ -149,7 +149,7 @@ public class JU_AbsAAFLocator {
assertThat(loc.setPathInfo("pathInfo"), is(not(nullValue())));
assertThat(loc.setQuery("query"), is(not(nullValue())));
assertThat(loc.setFragment("fragment"), is(not(nullValue())));
-
+
assertThat(loc.exposeGetURI(uri), is(not(uri)));
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_ArtifactDir.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_ArtifactDir.java
index 8bb873b3..ab377183 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_ArtifactDir.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_ArtifactDir.java
@@ -55,7 +55,7 @@ public class JU_ArtifactDir {
@Mock private Trans transMock;
@Mock private CertInfo certInfoMock;
@Mock private Artifact artiMock;
-
+
private static final String dirName = "src/test/resources/artifacts";
private static final String nsName = "org.onap.test";
private static final String luggagePassword = "12345"; // That's the stupidest combination I've ever heard in my life
@@ -65,17 +65,17 @@ public class JU_ArtifactDir {
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
-
+
issuers = new ArrayList<>();
issuers.add("issuer1");
issuers.add("issuer2");
}
-
+
@After
public void tearDown() {
ArtifactDir.clear();
}
-
+
@AfterClass
public static void tearDownOnce() {
cleanup();
@@ -91,7 +91,7 @@ public class JU_ArtifactDir {
} catch (CadiException e) {
assertThat(e.getMessage(), is("File Artifacts require a path\nFile Artifacts require an AAF Namespace"));
}
-
+
when(artiMock.getDir()).thenReturn(dirName);
try {
artiDir.place(transMock, certInfoMock, artiMock, "machine");
@@ -99,12 +99,12 @@ public class JU_ArtifactDir {
} catch (CadiException e) {
assertThat(e.getMessage(), is("File Artifacts require an AAF Namespace"));
}
-
+
when(artiMock.getNs()).thenReturn(nsName);
when(certInfoMock.getCaIssuerDNs()).thenReturn(issuers);
when(certInfoMock.getChallenge()).thenReturn(luggagePassword);
artiDir.place(transMock, certInfoMock, artiMock, "machine");
-
+
File writableFile = new File(dirName + '/' + nsName + "writable.txt");
ArtifactDir.write(writableFile, Chmod.to755, "first data point", "second data point");
try {
@@ -112,17 +112,17 @@ public class JU_ArtifactDir {
fail("Should've thrown an exception");
} catch (NullPointerException e) {
}
-
+
KeyStore ks = KeyStore.getInstance(Agent.PKCS12);
try {
ArtifactDir.write(writableFile, Chmod.to755, ks, luggagePassword.toCharArray());
fail("Should've thrown an exception");
} catch (CadiException e) {
}
-
+
ks.load(null, null);
ArtifactDir.write(writableFile, Chmod.to755, ks, luggagePassword.toCharArray());
-
+
ArtifactDirStud artiDir2 = new ArtifactDirStud();
artiDir2.place(transMock, certInfoMock, artiMock, "machine");
@@ -131,7 +131,7 @@ public class JU_ArtifactDir {
ArtifactDir.clear();
artiDir.place(transMock, certInfoMock, artiMock, "machine");
-
+
}
public void throwsTest() throws CadiException {
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CertException.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CertException.java
index 177ad3aa..36b3f220 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CertException.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CertException.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInFiles.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInFiles.java
index 6bb31b2f..f8b082fb 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInFiles.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInFiles.java
@@ -78,7 +78,7 @@ public class JU_PlaceArtifactInFiles {
assertThat(placer._place(transMock, certInfoMock, artiMock), is(true));
assertThat(new File(dirName + '/' + nsName + ".crt").exists(), is(true));
assertThat(new File(dirName + '/' + nsName + ".key").exists(), is(true));
-
+
when(certInfoMock.getCerts()).thenReturn(null);
try {
placer._place(transMock, certInfoMock, artiMock);
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInKeystore.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInKeystore.java
index a2782e78..237e0f64 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInKeystore.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInKeystore.java
@@ -114,7 +114,7 @@ public class JU_PlaceArtifactInKeystore {
// coverage
assertThat(placer.place(transMock, certInfoMock, artiMock, "machine"), is(true));
-
+
when(certInfoMock.getCerts()).thenReturn(null);
try {
placer._place(transMock, certInfoMock, artiMock);
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactOnStream.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactOnStream.java
index d66546bf..18292b21 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactOnStream.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactOnStream.java
@@ -47,7 +47,7 @@ public class JU_PlaceArtifactOnStream {
private static final String luggagePassword = "12345"; // That's the stupidest combination I've ever heard in my life
private static final String privateKeyString = "I'm a private key!";
-
+
private ByteArrayOutputStream outStream;
private List<String> certs;
@@ -63,7 +63,7 @@ public class JU_PlaceArtifactOnStream {
when(certInfoMock.getChallenge()).thenReturn(luggagePassword);
when(certInfoMock.getCerts()).thenReturn(certs);
when(certInfoMock.getPrivatekey()).thenReturn(privateKeyString);
-
+
outStream = new ByteArrayOutputStream();
}
@@ -71,9 +71,9 @@ public class JU_PlaceArtifactOnStream {
public void test() {
PlaceArtifactOnStream placer = new PlaceArtifactOnStream(new PrintStream(outStream));
placer.place(transMock, certInfoMock, artiMock, "machine");
-
+
String[] output = outStream.toString().split(System.lineSeparator(), 0);
-
+
String[] expected = {
"Challenge: " + luggagePassword,
"PrivateKey:",
@@ -82,7 +82,7 @@ public class JU_PlaceArtifactOnStream {
"cert1",
"cert2"
};
-
+
assertThat(output.length, is(expected.length));
for (int i = 0; i < output.length; i++) {
assertThat(output[i], is(expected[i]));
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_AAFToken.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_AAFToken.java
index 24e30a46..f94da881 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_AAFToken.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_AAFToken.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,7 +38,7 @@ public class JU_AAFToken {
UUID uuid2 = AAFToken.fromToken(token);
assertEquals(uuid, uuid2);
}
-
+
@Test
public void testMin() throws CadiException {
UUID uuid = new UUID(Long.MIN_VALUE,Long.MIN_VALUE);
@@ -61,7 +61,7 @@ public class JU_AAFToken {
public void nullTest() {
// Invalid characters
assertNull(AAFToken.fromToken("~~invalid characters~~"));
-
+
// Invalid CADI tokens
assertNull(AAFToken.fromToken("ABCDEF"));
assertNull(AAFToken.fromToken("12345678901234567890123456789012345678"));
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Lur.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Lur.java
index 3864cc25..ba83102e 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Lur.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Lur.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -42,17 +42,17 @@ import org.onap.aaf.cadi.oauth.TokenPerm;
import org.onap.aaf.cadi.principal.BearerPrincipal;
public class JU_OAuth2Lur {
-
+
private List<AAFPermission> aafPerms;
private List<Permission> perms;
-
+
@Mock private TokenMgr tmMock;
@Mock private AAFPermission pondMock;
@Mock private Principal princMock;
@Mock private OAuth2Principal oauthPrincMock;
@Mock private BearerPrincipal bearPrincMock;
@Mock private TokenPerm tpMock;
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
@@ -66,10 +66,10 @@ public class JU_OAuth2Lur {
assertThat(lur.fish(princMock, pondMock), is(false));
assertThat(lur.fish(oauthPrincMock, pondMock), is(false));
-
+
when(oauthPrincMock.tokenPerm()).thenReturn(tpMock);
assertThat(lur.fish(oauthPrincMock, pondMock), is(false));
-
+
aafPerms = new ArrayList<>();
aafPerms.add(pondMock);
aafPerms.add(pondMock);
@@ -84,9 +84,9 @@ public class JU_OAuth2Lur {
when(oauthPrincMock.tokenPerm()).thenReturn(null);
lur.fishAll(oauthPrincMock, perms);
-
+
assertThat(lur.handlesExclusively(pondMock), is(false));
-
+
assertThat(lur.handles(null), is(false));
assertThat(lur.handles(princMock), is(false));
assertThat(lur.handles(bearPrincMock), is(false));
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Principal.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Principal.java
index 630adacb..5cc15e25 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Principal.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Principal.java
@@ -22,7 +22,7 @@
package org.onap.aaf.cadi.oauth.test;
import static org.junit.Assert.assertThat;
-import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.mockito.Mockito.when;
import org.junit.Before;
@@ -35,16 +35,16 @@ import org.onap.aaf.cadi.oauth.TokenPerm;
public class JU_OAuth2Principal {
@Mock TokenPerm tpMock;
-
-
+
+
private static final String username = "username";
-
+
private static final byte[] hash = "hashstring".getBytes();
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
-
+
when(tpMock.getUsername()).thenReturn(username);
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java
index 6759d314..a0a6c10d 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -145,7 +145,7 @@ public class JU_OAuthTest {
Assert.fail(rtt.code + ' ' + rtt.error);
}
}
-
+
// ISAM Test
if (true) {
System.out.println("**** ISAM TEST ****");
@@ -156,7 +156,7 @@ public class JU_OAuthTest {
tc = tcf.newClient(tokenServiceURL, 3000);
tc.client_creds(client_id, client_secret);
int at = username.indexOf('@');
-
+
tc.password(at>=0?username.substring(0, at):username,access.getProperty("cadi_password"));
rtt = tc.getToken("org.osaaf.aaf","org.osaaf.test");
if (rtt.isOK()) {
@@ -164,7 +164,7 @@ public class JU_OAuthTest {
rtt = tc.refreshToken(rtt.value);
if (rtt.isOK()) {
print(rtt.value);
-
+
tc = tcf.newClient(tokenAltIntrospectURL, 3000);
tc.client_creds(client_id, client_secret);
Result<Introspect> rti = tc.introspect(rtt.value.getAccessToken());
@@ -211,8 +211,8 @@ public class JU_OAuthTest {
// Assert.fail();
}
}
-
-
+
+
// private TokenClient testROPCFlow(final String url, final String client_id, final String client_secret, String user, String password, final String ... scope) throws Exception {
// TokenClient tclient = tcf.newClient(url,3000);
// tclient.client_creds(client_id, client_secret);
@@ -233,7 +233,7 @@ public class JU_OAuthTest {
// }
// return tclient;
// }
-
+
private String serviceCall(TzClient tzClient) throws Exception {
return tzClient.best(new Retryable<String>() {
@Override
@@ -263,7 +263,7 @@ public class JU_OAuthTest {
t.getScope(),
t.getRefreshToken());
}
-
+
private void print(Introspect ti) {
if (ti==null || ti.getClientId()==null) {
System.out.println("Empty Introspect");
@@ -288,7 +288,7 @@ public class JU_OAuthTest {
Chrono.timeStamp(exp),
ti.getScope(),
ti.getContent()==null?"":ti.getContent());
-
+
System.out.println();
}
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenClientFactoryTest.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenClientFactoryTest.java
index e8fbbbd5..bc0ddc18 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenClientFactoryTest.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenClientFactoryTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenPerm.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenPerm.java
index c40e4eb5..f2d46039 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenPerm.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenPerm.java
@@ -98,7 +98,7 @@ public class JU_TokenPerm {
String json;
LoadPermissions lp;
Permission p;
-
+
json = "{\"perm\":[" +
" {\"ns\":\"com\",\"type\":\"access\",\"instance\":\"*\",\"action\":\"read,approve\"}," +
"]}";
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TzHClient.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TzHClient.java
index 805b13f1..504fa42d 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TzHClient.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TzHClient.java
@@ -53,32 +53,32 @@ import org.onap.aaf.cadi.oauth.TzHClient;
import org.onap.aaf.misc.env.APIException;
public class JU_TzHClient {
-
+
@Mock private Retryable<Integer> retryableMock;
@Mock private TimedToken tokenMock;
@Mock private SecurityInfoC<HttpURLConnection> siMock;
@Mock private Locator<URI> locMock;
@Mock private Item itemMock;
@Mock private Rcli<HttpURLConnection> clientMock;
-
+
private PropAccess access;
-
+
private ByteArrayOutputStream errStream;
-
+
private final static String client_id = "id";
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
access.setProperty(Config.CADI_LATITUDE, "38.62"); // St Louis approx lat
access.setProperty(Config.CADI_LONGITUDE, "90.19"); // St Louis approx long
- //access.setProperty("tag", "http://aaf.something.com");
-
+ //access.setProperty("tag", "http://aaf.something.com");
+
errStream = new ByteArrayOutputStream();
System.setErr(new PrintStream(errStream));
}
-
+
@After
public void tearDown() {
System.setErr(System.err);
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java
index 0394be97..74f2cf40 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -46,7 +46,7 @@ public class JU_RegistrationCreator {
pa.setProperty(Config.CADI_LATITUDE, "32.7");
pa.setProperty(Config.CADI_LONGITUDE, "-72.0");
pa.setProperty(Config.AAF_LOCATOR_NAME, "");
-
+
try {
String hostname = Inet4Address.getLocalHost().getHostName();
String entry = "";
@@ -82,7 +82,7 @@ public class JU_RegistrationCreator {
assertEquals(protocol,me.getProtocol());
assertEquals(0,me.getSpecialPorts().size());
}
-
+
pa.setProperty(Config.AAF_LOCATOR_ENTRIES, "service");
rc = new RegistrationCreator(pa);
for(MgmtEndpoint me : rc.create(port).getMgmtEndpoint()) {
@@ -141,7 +141,7 @@ public class JU_RegistrationCreator {
pa.setProperty(Config.AAF_LOCATOR_CONTAINER_NS+DOT_OOM, "onap");
String k8s_public_hostname="k8s.public.com";
int public_port = 30001;
-
+
pa.setProperty(Config.AAF_LOCATOR_PUBLIC_FQDN,k8s_public_hostname);
pa.setProperty(Config.AAF_LOCATOR_PUBLIC_PORT+DOT_OOM,Integer.toString(public_port));
pa.setProperty(Config.AAF_LOCATOR_APP_NS, Config.AAF_ROOT_NS_DEF);
@@ -173,7 +173,7 @@ public class JU_RegistrationCreator {
} catch (CadiException | UnknownHostException e) {
Assert.fail(e.getMessage());
}
-
+
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/sso/test/JU_AAFSSO.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/sso/test/JU_AAFSSO.java
index 9871c471..407a4ffd 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/sso/test/JU_AAFSSO.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/sso/test/JU_AAFSSO.java
@@ -60,8 +60,8 @@ public class JU_AAFSSO {
@Test
public void test() {
-
- // Note this is desctructive of personal dirs, and doesn't really test anything. Needs redoing.
+
+ // Note this is desctructive of personal dirs, and doesn't really test anything. Needs redoing.
// AAFSSO sso;
// String[] args;
//
@@ -71,7 +71,7 @@ public class JU_AAFSSO {
// };
// try {
// sso = new AAFSSO(args);
-//
+//
// assertThat(new File(aafDir).exists(), is(true));
// assertThat(new File(aafDir + "/.aaf").exists(), is(true));
// assertThat(new File(aafDir + "/.aaf/keyfile").exists(), is(true));
@@ -80,7 +80,7 @@ public class JU_AAFSSO {
//
//// Not necessarily true
//// assertThat(new File(aafDir + "/.aaf/sso.props").exists(), is(true));
-//
+//
// sso.setLogDefault();
// sso.setStdErrDefault();
//
@@ -104,7 +104,7 @@ public class JU_AAFSSO {
//
// sso.addProp("key", "value");
// assertThat(sso.err(), is(nullValue()));
-//
+//
// assertThat(sso.useX509(), is(false));
////
//// sso.close();
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/client/sample/Sample.java b/cadi/aaf/src/test/java/org/onap/aaf/client/sample/Sample.java
index 4e51579d..5e715b22 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/client/sample/Sample.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/client/sample/Sample.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,7 +44,7 @@ public class Sample {
final private AAFConHttp aafcon;
final private AAFLurPerm aafLur;
final private AAFAuthn<?> aafAuthn;
-
+
/**
* This method is to emphasize the importance of not creating the AAFObjects over and over again.
* @return
@@ -58,15 +58,15 @@ public class Sample {
aafLur = aafcon.newLur();
aafAuthn = aafcon.newAuthn(aafLur);
}
-
+
/**
* Checking credentials outside of HTTP/S presents fewer options initially. There is not, for instance,
- * the option of using 2-way TLS HTTP/S.
- *
- * However, Password Checks are still useful, and, if the Client Certificate could be obtained in other ways, the
+ * the option of using 2-way TLS HTTP/S.
+ *
+ * However, Password Checks are still useful, and, if the Client Certificate could be obtained in other ways, the
* Interface can be expanded in the future to include Certificates.
- * @throws CadiException
- * @throws IOException
+ * @throws CadiException
+ * @throws IOException
*/
public Principal checkUserPass(String fqi, String pass) throws IOException, CadiException {
String ok = aafAuthn.validate(fqi, pass);
@@ -76,7 +76,7 @@ public class Sample {
UnAuthPrincipal means that it is not coming from the official Authorization chain.
This is useful for Security Plugins which don't use Principal as the tie between
Authentication and Authorization
-
+
You can also use this if you want to check Authorization without actually Authenticating, as may
be the case with certain Onboarding Tooling.
*/
@@ -85,64 +85,64 @@ public class Sample {
System.out.printf("Failure: %s\n",ok);
return null;
}
-
+
}
/**
* An example of looking for One Permission within all the permissions user has. CADI does cache these,
* so the call is not expensive.
- *
- * Note: If you are using "J2EE" (Servlets), CADI ties this function to the method:
+ *
+ * Note: If you are using "J2EE" (Servlets), CADI ties this function to the method:
* HttpServletRequest.isUserInRole(String user)
- *
+ *
* The J2EE user can expect that his servlet will NOT be called without a Validated Principal, and that
* "isUserInRole()" will validate if the user has the Permission designated.
- *
+ *
*/
public boolean oneAuthorization(Principal fqi, Permission p) {
return aafLur.fish(fqi, p);
}
-
+
public List<Permission> allAuthorization(Principal fqi) {
List<Permission> pond = new ArrayList<>();
aafLur.fishAll(fqi, pond);
return pond;
}
-
-
+
+
public static void main(String[] args) {
// Note: you can pick up Properties from Command line as well as VM Properties
// Code "user_fqi=... user_pass=..." (where user_pass can be encrypted) in the command line for this sample.
// Also code "perm=<perm type>|<instance>|<action>" to test a specific Permission
- PropAccess myAccess = new PropAccess(args);
+ PropAccess myAccess = new PropAccess(args);
try {
/*
* NOTE: Do NOT CREATE new aafcon, aafLur and aafAuthn each transaction. They are built to be
* reused!
- *
+ *
* This is why this code demonstrates "Sample" as a singleton.
*/
singleton = new Sample(myAccess);
String user = myAccess.getProperty("user_fqi");
String pass= myAccess.getProperty("user_pass");
-
+
if (user==null || pass==null) {
System.err.println("This Sample class requires properties user_fqi and user_pass");
} else {
pass = myAccess.decrypt(pass, false); // Note, with "false", decryption will only happen if starts with "enc:"
// See the CODE for Java Methods used
Principal fqi = Sample.singleton().checkUserPass(user,pass);
-
+
if (fqi==null) {
System.out.println("OK, normally, you would cease processing for an "
+ "unauthenticated user, but for the purpose of Sample, we'll keep going.\n");
fqi=new UnAuthPrincipal(user);
}
-
+
// AGAIN, NOTE: If your client fails Authentication, the right behavior 99.9%
// of the time is to drop the transaction. We continue for sample only.
-
+
// note, default String for perm
String permS = myAccess.getProperty("perm","org.osaaf.aaf.access|*|read");
String[] permA = Split.splitTrim('|', permS);
@@ -155,8 +155,8 @@ public class Sample {
System.out.printf("%s does NOT have %s\n",fqi.getName(),permS);
}
}
-
-
+
+
// Another form, you can get ALL permissions in a list
// See the CODE for Java Methods used
List<Permission> permL = singleton().allAuthorization(fqi);
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/content/JU_Content.java b/cadi/aaf/src/test/java/org/onap/aaf/content/JU_Content.java
index 41be6df8..efa0106b 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/content/JU_Content.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/content/JU_Content.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -48,13 +48,13 @@ public class JU_Content {
"\"m55555@jr583u.cred.test.com 1 Thu Oct 09 12:54:46 CDT 2014\"," +
"\"m55555@jr583u.cred.test.com 1 Tue Jan 06 05:00:00 CST 2015\"," +
"\"m55555@jr583u.cred.test.com 1 Wed Jan 07 05:00:00 CST 2015\"]}";
-
+
Error err = new Error();
err.setText("Hello");
err.getVariables().add("I'm a teapot");
err.setMessageId("12");
-
-
+
+
// System.out.println(msg);
RosettaEnv env = new RosettaEnv();
RosettaDF<aaf.v2_0.Error> errDF = env.newDataFactory(aaf.v2_0.Error.class);
@@ -62,16 +62,16 @@ public class JU_Content {
errDF.out(RosettaData.TYPE.JSON);
RosettaData<Error> data = errDF.newData();
data.load(err);
-
+
@SuppressWarnings("unused")
String output = data.asString();
// System.out.println(output);
-
+
data.load(new StringReader(msg));
err = data.asObject();
output = err.getText();
// System.out.println(output);
}
-
+
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java
index da85702d..1db9317a 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,19 +29,19 @@ import org.onap.aaf.cadi.config.SecurityInfoC;
/**
* AbsAuthentication is a class representing how to Authenticate onto a Client.
- *
+ *
* Methods of setting Authentication on a Client vary, so CLIENT is a Generic Type
- * This allows the ability to apply security onto Different Client Types, as they come
+ * This allows the ability to apply security onto Different Client Types, as they come
* into vogue, or change over time.
- *
+ *
* Password is encrypted at rest.
- *
+ *
* @author Jonathan
*
* @param <CLIENT>
*/
public abstract class AbsAuthentication<CLIENT> implements SecuritySetter<CLIENT> {
- // HTTP Header for Authentication is "Authorization". This was from an early stage of internet where
+ // HTTP Header for Authentication is "Authorization". This was from an early stage of internet where
// Access by Credential "Authorized" you for everything on the site. Since those early days, it became
// clear that "full access" wasn't appropriate, so the split between Authentication and Authorization
// came into being... But the Header remains.
@@ -57,14 +57,14 @@ public abstract class AbsAuthentication<CLIENT> implements SecuritySetter<CLIENT
protected final SecurityInfoC<CLIENT> securityInfo;
protected long lastMiss;
protected int count;
-
+
static {
try {
symm = Symm.encrypt.obtain();
} catch (IOException e) {
throw new RuntimeException("Cannot create critical internal encryption key",e);
}
-
+
}
public AbsAuthentication(final SecurityInfoC<CLIENT> securityInfo, final String user, final byte[] headValue) throws IOException {
@@ -82,11 +82,11 @@ public abstract class AbsAuthentication<CLIENT> implements SecuritySetter<CLIENT
return new String(symm.decode(headValue));
}
}
-
+
protected void setUser(String id) {
user = id;
}
-
+
@Override
public String getID() {
return user;
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java
index baac6daa..80234460 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,10 +29,10 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
/**
* This client represents the ability to Transfer the Identity of the caller to the authenticated
- * user being transferred to. This ability is critical for App-to-App communication to ensure that
+ * user being transferred to. This ability is critical for App-to-App communication to ensure that
* Authorization can happen on the End-Users' credentials when appropriate, even though Authentication
* to App1 by App2 must be by App2's credentials.
- *
+ *
* @author Jonathan
*
* @param <CLIENT>
@@ -59,8 +59,8 @@ public abstract class AbsTransferSS<CLIENT> implements SecuritySetter<CLIENT> {
if (principal==null) {
return;
} else {
- value = principal.getName() + ':' +
- app + ':' +
+ value = principal.getName() + ':' +
+ app + ':' +
principal.tag() + ':' +
"AS";
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java
index 1eb8d7c4..021229ce 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java
index 9aa9cad6..7a437e39 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,7 +44,7 @@ public interface EClient<CT> {
public<T> Future<T> futureRead(RosettaDF<T> df,Data.TYPE type);
public<T> Future<T> future(T t);
public Future<Void> future(HttpServletResponse resp, int expected) throws APIException;
-
+
public interface Transfer {
public void transfer(OutputStream os) throws IOException, APIException;
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java
index 39f88687..de32d959 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,7 +26,7 @@ import org.onap.aaf.cadi.CadiException;
public abstract class Future<T> {
public T value;
public abstract boolean get(int timeout) throws CadiException;
-
+
public abstract int code();
public abstract String body();
public abstract String header(String tag);
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java
index af97c465..8744e896 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,7 +36,7 @@ public class Holder<T> {
value = t;
return t;
}
-
+
public T get() {
return value;
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java
index 6b486b8e..cfc52fb4 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -94,9 +94,9 @@ public abstract class Rcli<CT> {
rv.apiVersion = apiVersion;
return rv;
}
-
+
protected abstract Rcli<CT> clone(URI uri, SecuritySetter<CT> ss);
-
+
public abstract void invalidate() throws CadiException;
public Rcli<CT> readTimeout(int millis) {
@@ -118,7 +118,7 @@ public abstract class Rcli<CT> {
this.apiVersion = apiVersion;
return this;
}
-
+
public boolean isApiVersion(String prospective) {
return apiVersion.equals(prospective);
}
@@ -294,7 +294,7 @@ public abstract class Rcli<CT> {
/**
* Read String, using POST for keyInfo
- *
+ *
* @param pathinfo
* @param df
* @param t
@@ -335,7 +335,7 @@ public abstract class Rcli<CT> {
*/
public<T,R> Future<R> readPost(String pathinfo, final RosettaDF<T> df, final T t, final RosettaDF<R> resp) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
-
+
EClient<CT> client = client();
client.setMethod(POST);
client.addHeader(CONTENT_TYPE,typeString(df.getTypeClass()));
@@ -371,11 +371,11 @@ public abstract class Rcli<CT> {
public Future<String> read(String pathinfo, String accept, String ... headers) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
-
+
EClient<CT> client = client();
client.setMethod(GET);
client.addHeader(ACCEPT, accept);
-
+
for (int i=1;i<headers.length;i=i+2) {
client.addHeader(headers[i-1],headers[i]);
}
@@ -416,7 +416,7 @@ public abstract class Rcli<CT> {
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
client.setFragment(pp.frag());
-
+
client.setPayload(null);
client.send();
return client.futureRead(df,type);
@@ -430,7 +430,7 @@ public abstract class Rcli<CT> {
client.addHeader(ACCEPT, typeString(cls));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(null);
client.send();
@@ -445,7 +445,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE,contentType);
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
public void transfer(OutputStream os) throws IOException, APIException {
@@ -455,16 +455,16 @@ public abstract class Rcli<CT> {
client.send();
return client.future(t);
}
-
+
public<T> Future<String> updateRespondString(String pathinfo, final RosettaDF<T> df, final T t) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
-
+
EClient<CT> client = client();
client.setMethod(PUT);
client.addHeader(CONTENT_TYPE, typeString(df.getTypeClass()));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
@@ -476,7 +476,7 @@ public abstract class Rcli<CT> {
client.send();
return client.futureReadString();
}
-
+
public Future<String> update(String pathinfo, String contentType, EClient.Transfer content) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
@@ -502,8 +502,8 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(df.getTypeClass()));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
-
+ client.setFragment(pp.frag());
+
client.setPayload(new EClient.Transfer() {
@Override
public void transfer(OutputStream os) throws IOException, APIException {
@@ -513,16 +513,16 @@ public abstract class Rcli<CT> {
client.send();
return client.future(t);
}
-
+
public<T> Future<T> update(String pathinfo, Class<?> cls, final RosettaDF<T> df, final T t) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
-
+
EClient<CT> client = client();
client.setMethod(PUT);
client.addHeader(CONTENT_TYPE, typeString(cls));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
@@ -533,7 +533,7 @@ public abstract class Rcli<CT> {
client.send();
return client.future(t);
}
-
+
/**
@@ -553,7 +553,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(Void.class));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
// client.setPayload(new EClient.Transfer() {
// @Override
@@ -563,7 +563,7 @@ public abstract class Rcli<CT> {
client.send();
return client.future(null);
}
-
+
public<T> Future<T> delete(String pathinfo, String contentType, final RosettaDF<T> df, final T t) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
@@ -573,7 +573,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, contentType);
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
@@ -593,7 +593,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(cls));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
public void transfer(OutputStream os) throws IOException, APIException {
@@ -612,7 +612,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(df.getTypeClass()));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
public void transfer(OutputStream os) throws IOException, APIException {
@@ -633,7 +633,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(cls));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(null);
client.send();
@@ -648,7 +648,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, contentType);
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(null);
client.send();
@@ -681,7 +681,7 @@ public abstract class Rcli<CT> {
int read;
// reuse Buffers
Pooled<byte[]> pbuff = buffPool.get();
- try {
+ try {
while ((read=is.read(pbuff.content))>=0) {
os.write(pbuff.content,0,read);
}
@@ -713,13 +713,13 @@ public abstract class Rcli<CT> {
queryEnd = pound>=0?pound:path.length();
if (oneCallQueryParams==null) {
if (query>=0) {
- queryParams = path.substring(query+1,queryEnd);
+ queryParams = path.substring(query+1,queryEnd);
} else {
queryParams=null;
}
} else {
if (query>=0) {
- queryParams = oneCallQueryParams + '&' + path.substring(query+1,queryEnd);
+ queryParams = oneCallQueryParams + '&' + path.substring(query+1,queryEnd);
} else {
queryParams = oneCallQueryParams;
}
@@ -727,7 +727,7 @@ public abstract class Rcli<CT> {
}
}
}
-
+
public String path() {
if (query>=0) {
if (pound>=0) {
@@ -740,11 +740,11 @@ public abstract class Rcli<CT> {
return path;
}
}
-
+
public String query() {
return queryParams;
}
-
+
public String frag() {
if (pound>=0) {
return path.substring(pound+1);
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java
index 0e2a4b16..5b8bf920 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,7 +35,7 @@ public class Result<T> {
public static<T> Result<T> ok(int code,T t) {
return new Result<T>(code,t,null);
}
-
+
public static<T> Result<T> err(int code,String body) {
return new Result<T>(code,null,body);
}
@@ -47,7 +47,7 @@ public class Result<T> {
public boolean isOK() {
return error==null;
}
-
+
public String toString() {
StringBuilder sb = new StringBuilder("Code: ");
sb.append(code);
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java
index 58e7718d..6d85a420 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,7 +28,7 @@ import org.onap.aaf.cadi.Locator;
import org.onap.aaf.misc.env.APIException;
/**
- *
+ *
* @author Jonathan
*
* @param <RT>
@@ -38,7 +38,7 @@ public abstract class Retryable<RET> {
// be able to hold state for consistent Connections. Not required for all connection types.
public Rcli<?> lastClient;
private Locator.Item item;
-
+
public Retryable() {
lastClient = null;
item = null;
@@ -57,7 +57,7 @@ public abstract class Retryable<RET> {
public Locator.Item item() {
return item;
}
-
+
public abstract RET code(Rcli<?> client) throws CadiException, ConnectException, APIException;
/**
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java
index c2f56458..744aba43 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@ import org.onap.aaf.cadi.client.AbsAuthentication;
import org.onap.aaf.cadi.config.SecurityInfoC;
public class HAuthorizationHeader extends AbsAuthentication<HttpURLConnection> {
-
+
public HAuthorizationHeader(SecurityInfoC<HttpURLConnection> si, String user, String headValue) throws IOException {
super(si,user,headValue==null?null:headValue.getBytes());
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java
index 38465da4..d280b9cb 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -42,12 +42,12 @@ public class HBasicAuthSS extends HAuthorizationHeader implements BasicAuth {
this(si,si.access.getProperty(Config.AAF_APPID, null),
si.access.decrypt(si.access.getProperty(Config.AAF_APPPASS, null), false));
}
-
+
public HBasicAuthSS(SecurityInfoC<HttpURLConnection> si, boolean setDefault) throws IOException {
this(si,si.access.getProperty(Config.AAF_APPID, null),
si.access.decrypt(si.access.getProperty(Config.AAF_APPPASS, null), false),setDefault);
}
-
+
public HBasicAuthSS(SecurityInfoC<HttpURLConnection> si, String user, String pass, boolean asDefault) throws IOException {
this(si, user,pass);
@@ -55,11 +55,11 @@ public class HBasicAuthSS extends HAuthorizationHeader implements BasicAuth {
si.set(this);
}
}
-
+
public HBasicAuthSS(BasicPrincipal bp, SecurityInfoC<HttpURLConnection> si) throws IOException {
this(si, bp.getName(),new String(bp.getCred()));
}
-
+
public HBasicAuthSS(BasicPrincipal bp, SecurityInfoC<HttpURLConnection> si, boolean asDefault) throws IOException {
this(si, bp.getName(),new String(bp.getCred()));
if (asDefault) {
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
index 61112c47..cef4ae47 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -49,7 +49,7 @@ import org.onap.aaf.misc.rosetta.env.RosettaDF;
/**
* Low Level Http Client Mechanism. Chances are, you want the high level "HRcli"
* for Rosetta Object Translation
- *
+ *
* @author Jonathan
*
*/
@@ -72,7 +72,7 @@ public class HClient implements EClient<HttpURLConnection> {
this.uri = uri;
this.ss = ss;
this.connectTimeout = connectTimeout;
- pathinfo = query = fragment = null;
+ pathinfo = query = fragment = null;
}
@Override
@@ -89,7 +89,7 @@ public class HClient implements EClient<HttpURLConnection> {
public void setPayload(Transfer transfer) {
this.transfer = transfer;
}
-
+
@Override
public void addHeader(String tag, String value) {
if (headers == null)
@@ -133,10 +133,10 @@ public class HClient implements EClient<HttpURLConnection> {
huc = getConnection(sendURI, pi);
huc.setRequestMethod(meth);
if (ss!=null) {
- ss.setSecurity(huc);
+ ss.setSecurity(huc);
}
if (headers != null)
- for (Header d : headers) {
+ for (Header d : headers) {
huc.addRequestProperty(d.tag, d.value);
}
huc.setDoInput(true);
@@ -164,11 +164,11 @@ public class HClient implements EClient<HttpURLConnection> {
pathinfo = query = fragment = "";
}
}
-
+
public URI getURI() {
return uri;
}
-
+
public void setURI(URI uri) {
this.uri = uri;
}
@@ -176,31 +176,31 @@ public class HClient implements EClient<HttpURLConnection> {
public int timeout() {
return connectTimeout;
}
-
+
protected HttpURLConnection getConnection(URI uri, StringBuilder pi) throws IOException, URISyntaxException {
URL url = new URI(
- uri.getScheme(),
+ uri.getScheme(),
uri.getAuthority(),
- pi==null?uri.getPath():pi.toString(),
+ pi==null?uri.getPath():pi.toString(),
query,
fragment).toURL();
return (HttpURLConnection) url.openConnection();
}
-
+
public abstract class HFuture<T> extends Future<T> {
protected HttpURLConnection huc;
protected int respCode;
protected IOException exception;
protected StringBuilder errContent;
-
+
public HFuture(final HttpURLConnection huc) {
this.huc = huc;
}
-
+
protected boolean evalInfo(HttpURLConnection huc) throws APIException, IOException{
return respCode == 200;
};
-
+
@Override
public final boolean get(int timeout) throws CadiException {
try {
@@ -219,7 +219,7 @@ public class HClient implements EClient<HttpURLConnection> {
close();
}
}
-
+
private void extractError() {
InputStream is = huc.getErrorStream();
try {
@@ -237,7 +237,7 @@ public class HClient implements EClient<HttpURLConnection> {
exception = e;
}
}
-
+
// Typically only used by Read
public StringBuilder inputStreamToString(InputStream is) {
// Avoids Carriage returns, and is reasonably efficient, given
@@ -260,26 +260,26 @@ public class HClient implements EClient<HttpURLConnection> {
return null;
}
}
-
-
+
+
@Override
public int code() {
return respCode;
}
-
+
public HttpURLConnection huc() {
return huc;
}
-
+
public IOException exception() {
return exception;
}
-
+
@Override
public String header(String tag) {
return huc.getHeaderField(tag);
}
-
+
public void close() {
if (huc!=null) {
huc.disconnect();
@@ -393,7 +393,7 @@ public class HClient implements EClient<HttpURLConnection> {
is = huc.getInputStream();
// reuse Buffers
Pooled<byte[]> pbuff = Rcli.buffPool.get();
- try {
+ try {
while ((read=is.read(pbuff.content))>=0) {
os.write(pbuff.content,0,read);
}
@@ -409,7 +409,7 @@ public class HClient implements EClient<HttpURLConnection> {
if (is!=null) {
errContent = new StringBuilder();
Pooled<byte[]> pbuff = Rcli.buffPool.get();
- try {
+ try {
while ((read=is.read(pbuff.content))>=0) {
os.write(pbuff.content,0,read);
}
@@ -436,12 +436,12 @@ public class HClient implements EClient<HttpURLConnection> {
this.tag = t;
this.value = v;
}
-
+
public String toString() {
return tag + '=' + value;
}
}
-
+
public String toString() {
return "HttpURLConnection Client configured to " + uri.toString();
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
index 19e40b3a..1d1f2732 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -46,7 +46,7 @@ public class HMangr {
private int readTimeout, connectionTimeout;
public final Locator<URI> loc;
private Access access;
-
+
public HMangr(Access access, Locator<URI> loc) throws LocatorException {
readTimeout = 10000;
connectionTimeout=3000;
@@ -58,18 +58,18 @@ public class HMangr {
}
/**
- * Reuse the same service. This is helpful for multiple calls that change service side cached data so that
+ * Reuse the same service. This is helpful for multiple calls that change service side cached data so that
* there is not a speed issue.
- *
+ *
* If the service goes down, another service will be substituted, if available.
- *
+ *
* @param access
* @param loc
* @param ss
* @param item
* @param retryable
* @return
- * @throws URISyntaxException
+ * @throws URISyntaxException
* @throws Exception
*/
public<RET> RET same(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable) throws APIException, CadiException, LocatorException {
@@ -107,7 +107,7 @@ public class HMangr {
} else {
client.setSecuritySetter(ss);
}
-
+
retry = false;
try {
ret = retryable.code(client);
@@ -118,14 +118,14 @@ public class HMangr {
try {
Throwable ec = e.getCause();
if (ec instanceof java.net.ConnectException) {
- if (client!=null && loc.hasItems()) {
+ if (client!=null && loc.hasItems()) {
access.log(Level.WARN,"Connection refused, trying next available service");
retry = true;
} else {
throw new CadiException("Connection refused, no more services to try");
}
} else if (ec instanceof java.net.SocketException) {
- if (client!=null && loc.hasItems()) {
+ if (client!=null && loc.hasItems()) {
access.log(Level.WARN,"Socket prematurely closed, trying next available service");
retry = true;
} else {
@@ -155,8 +155,8 @@ public class HMangr {
}
return ret;
}
-
-
+
+
public<RET> RET best(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable) throws LocatorException, CadiException, APIException {
retryable.item(loc.best());
return same(ss,retryable);
@@ -168,7 +168,7 @@ public class HMangr {
public<RET> RET all(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable,boolean notify) throws LocatorException, CadiException, APIException {
return call(ss,retryable,notify,null);
}
-
+
public <RET> RET allExcept(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable,boolean notify, String selfHost) throws LocatorException, CadiException, APIException {
return call(ss,retryable,notify,selfHost);
}
@@ -211,12 +211,12 @@ public class HMangr {
access.log(Level.ERROR,"Connection to",uri,"refused during call to all services");
}
}
-
- if (ret == null && notify)
+
+ if (ret == null && notify)
throw new LocatorException("No available clients to call");
return ret;
}
-
+
public void close() {
// TODO Anything here?
@@ -230,7 +230,7 @@ public class HMangr {
public int readTimeout() {
return readTimeout;
}
-
+
public void connectionTimeout(int t) {
connectionTimeout = t;
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java
index 1fecce2b..2b6a9ac2 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java
index cbd7b33e..70ca4902 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,9 +36,9 @@ import org.onap.aaf.misc.env.Data.TYPE;
/**
* Rosetta Client
- *
+ *
* JAXB defined JSON or XML over HTTP/S
- *
+ *
* @author Jonathan
*
* @param <T>
@@ -74,10 +74,10 @@ public class HRcli extends Rcli<HttpURLConnection> {
/**
- *
+ *
* @return
- * @throws APIException
- * @throws DME2Exception
+ * @throws APIException
+ * @throws DME2Exception
*/
protected EClient<HttpURLConnection> client() throws CadiException {
try {
@@ -93,7 +93,7 @@ public class HRcli extends Rcli<HttpURLConnection> {
throw new CadiException(e);
}
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.cadi.client.Rcli#setSecuritySetter(org.onap.aaf.cadi.SecuritySetter)
*/
@@ -117,7 +117,7 @@ public class HRcli extends Rcli<HttpURLConnection> {
throw new CadiException(e);
}
}
-
+
public HRcli setManager(HMangr hman) {
this.hman = hman;
return this;
@@ -126,5 +126,5 @@ public class HRcli extends Rcli<HttpURLConnection> {
public String toString() {
return uri.toString();
}
-
+
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java
index 7c7d391f..0da76e91 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,7 +32,7 @@ import org.onap.aaf.misc.env.APIException;
/**
* This class will pick out the best default SS for Clients per Client type
- *
+ *
* @author Instrumental
*
*/
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java
index cd20585f..99b73ed7 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java
index f68c1f61..d8c8d5ad 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@ public class HTransferSS extends AbsTransferSS<HttpURLConnection> {
public HTransferSS(TaggedPrincipal principal, String app) throws IOException {
super(principal, app);
}
-
+
public HTransferSS(TaggedPrincipal principal, String app, SecurityInfoC<HttpURLConnection> si) {
super(principal, app, si);
}
@@ -55,7 +55,7 @@ public class HTransferSS extends AbsTransferSS<HttpURLConnection> {
securityInfo.setSocketFactoryOn((HttpsURLConnection)huc);
}
}
-
+
@Override
public int setLastResponse(int respCode) {
return 0;
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java
index f441186e..89c11b69 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -57,11 +57,11 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
public HX509SS(SecurityInfoC<HttpURLConnection> si) throws APIException, CadiException {
this(null,si,false);
}
-
+
public HX509SS(SecurityInfoC<HttpURLConnection> si, boolean asDefault) throws APIException, CadiException {
this(null,si,asDefault);
}
-
+
public HX509SS(final String sendAlias, SecurityInfoC<HttpURLConnection> si) throws APIException, CadiException {
this(sendAlias, si, false);
}
@@ -75,7 +75,7 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
alias = si.defaultAlias;
}
}
-
+
priv=null;
X509KeyManager[] xkms = si.getKeyManagers();
if (xkms==null || xkms.length==0) {
@@ -88,9 +88,9 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
for (int i=0;cert==null&&i<xkms.length;++i) {
X509Certificate[] chain = xkms[i].getCertificateChain(alias);
if (chain!=null&&chain.length>0) {
- algo = chain[0].getSigAlgName();
+ algo = chain[0].getSigAlgName();
pub = chain[0].getEncoded();
- ByteArrayOutputStream baos = new ByteArrayOutputStream(pub.length*2);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(pub.length*2);
ByteArrayInputStream bais = new ByteArrayInputStream(pub);
Symm.base64noSplit.encode(bais,baos,X509);
cert = baos.toString();
@@ -111,32 +111,32 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
}
if (alias==null) { // must be a one-way
huc.setRequestProperty(AbsAuthentication.AUTHORIZATION, cert);
-
+
// Test Signed content
try {
String data = "SignedContent["+ inc() + ']' + Chrono.dateTime();
huc.setRequestProperty("Data", data);
-
+
Signature sig = Signature.getInstance(algo);
sig.initSign(priv);
sig.update(data.getBytes());
byte[] signature = sig.sign();
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream((int)(signature.length*1.3));
ByteArrayInputStream bais = new ByteArrayInputStream(signature);
Symm.base64noSplit.encode(bais, baos);
huc.setRequestProperty("Signature", new String(baos.toByteArray()));
-
+
} catch (Exception e) {
throw new CadiException(e);
}
}
}
-
+
private synchronized int inc() {
return ++count;
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.cadi.SecuritySetter#getID()
*/
@@ -144,7 +144,7 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
public String getID() {
return alias;
}
-
+
@Override
public int setLastResponse(int respCode) {
return 0;
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java
index 8053dabf..c0b9f375 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,7 +33,7 @@ import org.onap.aaf.cadi.LocatorException;
public class DNSLocator implements SizedLocator<URI> {
private static enum Status {UNTRIED, OK, INVALID, SLOW};
private static final int CHECK_TIME = 3000;
-
+
private String host, protocol;
private Access access;
private Host[] hosts;
@@ -41,7 +41,7 @@ public class DNSLocator implements SizedLocator<URI> {
private String suffix;
private int size = 1; // initial, until refreshed.
-
+
public DNSLocator(Access access, String protocol, String host, String range) {
this.host = host;
this.protocol = protocol;
@@ -164,7 +164,7 @@ public class DNSLocator implements SizedLocator<URI> {
}
return false;
}
-
+
private String parseHostAndPorts(String aaf_locate, int _start, int defaultPort) throws LocatorException {
int slash, start;
int colon = aaf_locate.indexOf(':',_start);
@@ -193,7 +193,7 @@ public class DNSLocator implements SizedLocator<URI> {
if(slash>=0) {
suffix = aaf_locate.substring(slash);
}
-
+
} else {
slash = aaf_locate.indexOf('/', start);
if (slash == start) {
@@ -211,7 +211,7 @@ public class DNSLocator implements SizedLocator<URI> {
host = slash<_start?aaf_locate.substring(_start):aaf_locate.substring(_start,slash);
startPort = endPort = defaultPort;
}
-
+
return host;
}
@@ -219,18 +219,18 @@ public class DNSLocator implements SizedLocator<URI> {
private URI uri;
private InetAddress ia;
private Status status;
-
+
public Host(InetAddress inetAddress, int port, String suffix) throws URISyntaxException {
ia = inetAddress;
uri = new URI(protocol,null,inetAddress.getCanonicalHostName(),port,suffix,null,null);
status = Status.UNTRIED;
}
-
+
public String toString() {
return uri.toString() + " - " + status.name();
}
}
-
+
private class DLItem implements Item {
public DLItem(int i) {
cnt = i;
@@ -238,7 +238,7 @@ public class DNSLocator implements SizedLocator<URI> {
private int cnt;
}
-
+
public void destroy() {}
public int size() {
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java
index 488d35d5..57eca417 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,7 +35,7 @@ public class HClientHotPeerLocator extends HotPeerLocator<HClient> {
public HClientHotPeerLocator(Access access, String urlstr, long invalidateTime, String localLatitude,
String localLongitude, HX509SS ss) throws LocatorException {
super(access, urlstr, invalidateTime, localLatitude, localLongitude);
-
+
this.ss = ss;
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
index 34889138..d332a7f3 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -54,7 +54,7 @@ public class PropertyLocator implements Locator<URI> {
}
/**
* comma delimited root url list
- *
+ *
* @param locList
* @throws LocatorException
*/
@@ -67,9 +67,9 @@ public class PropertyLocator implements Locator<URI> {
}
String[] locarray = Split.split(',',locList);
List<URI> uriList = new ArrayList<>();
-
+
random = new SecureRandom();
-
+
for (int i=0;i<locarray.length;++i) {
try {
int range = locarray[i].indexOf(":[");
@@ -234,7 +234,7 @@ public class PropertyLocator implements Locator<URI> {
} else {
newCurrent = current;
}
-
+
for (int i=0; i< end; ++i) {
if (newCurrent[i]==null){
newCurrent[i]=new PLItem(i);
@@ -257,14 +257,14 @@ public class PropertyLocator implements Locator<URI> {
protected Socket createSocket() {
return new Socket();
}
-
+
private class PLItem implements Item {
public int idx,order;
-
+
public PLItem(int i) {
idx = order =i;
}
-
+
public String toString() {
return "Item: " + idx + " order: " + order;
}
@@ -294,7 +294,7 @@ public class PropertyLocator implements Locator<URI> {
}
return sb.toString();
}
-
+
public void destroy() {
}
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java
index b0654cfa..862868f0 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,19 +28,19 @@ import org.onap.aaf.cadi.LocatorException;
public class SingleEndpointLocator implements SizedLocator<URI> {
private final URI uri;
- private final static Item item = new Item() {};
+ private final static Item item = new Item() {};
private Date noRetryUntil;
-
+
public SingleEndpointLocator(final URI uri) {
this.uri = uri;
}
-
+
public SingleEndpointLocator(final String endpoint) throws LocatorException {
try {
- this.uri = new URI(endpoint);
- } catch (URISyntaxException e) {
- throw new LocatorException(e);
- }
+ this.uri = new URI(endpoint);
+ } catch (URISyntaxException e) {
+ throw new LocatorException(e);
+ }
}
@Override
@@ -63,7 +63,7 @@ public class SingleEndpointLocator implements SizedLocator<URI> {
@Override
public void invalidate(Item item) throws LocatorException {
// one minute timeout, because there is no other item
- noRetryUntil = new Date(System.currentTimeMillis()+60000);
+ noRetryUntil = new Date(System.currentTimeMillis()+60000);
}
@Override
@@ -87,10 +87,10 @@ public class SingleEndpointLocator implements SizedLocator<URI> {
// Never refreshed
return true;
}
-
+
@Override
public int size() {
- return 1;
+ return 1;
}
@Override
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java
index 65a34738..40792649 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,5 +24,5 @@ package org.onap.aaf.cadi.locator;
import org.onap.aaf.cadi.Locator;
public interface SizedLocator<T> extends Locator<T> {
- public abstract int size();
+ public abstract int size();
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java b/cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java
index 27eb507f..f72e5290 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,33 +24,33 @@ package org.onap.aaf.cadi.routing;
import org.onap.aaf.misc.env.util.Split;
public class GreatCircle {
- // Note: multiplying by this constant is faster than calling Math equivalent function
+ // Note: multiplying by this constant is faster than calling Math equivalent function
private static final double DEGREES_2_RADIANS = Math.PI/180.0;
-
+
public static final double DEGREES_2_NM = 60;
public static final double DEGREES_2_KM = DEGREES_2_NM * 1.852; // 1.852 is exact ratio per 1929 Standard Treaty, adopted US 1954
- public static final double DEGREES_2_MI = DEGREES_2_NM * 1.1507795;
-
+ public static final double DEGREES_2_MI = DEGREES_2_NM * 1.1507795;
+
/**
- *
+ *
* Calculate the length of an arc on a perfect sphere based on Latitude and Longitudes of two points
* Parameters are in Degrees (i.e. the coordinate system you get from GPS, Mapping WebSites, Phones, etc)
- *
+ *
* L1 = Latitude of point A
* G1 = Longitude of point A
* L2 = Latitude of point B
* G2 = Longitude of point B
- *
+ *
* d = acos (sin(L1)*sin(L2) + cos(L1)*cos(L2)*cos(G1 - G2))
- *
+ *
* Returns answer in Degrees
- *
+ *
* Since there are 60 degrees per nautical miles, you can convert to NM by multiplying by 60
- *
- * Essential formula from a Princeton website, the "Law of Cosines" method.
- *
+ *
+ * Essential formula from a Princeton website, the "Law of Cosines" method.
+ *
* Refactored cleaned up for speed Jonathan 3/8/2013
- *
+ *
* @param latA
* @param lonA
* @param latB
@@ -66,19 +66,19 @@ public class GreatCircle {
lonB *= DEGREES_2_RADIANS;
return Math.acos(
- Math.sin(latA) * Math.sin(latB) +
+ Math.sin(latA) * Math.sin(latB) +
Math.cos(latA) * Math.cos(latB) * Math.cos(lonA-lonB)
)
/ DEGREES_2_RADIANS;
}
-
- /**
+
+ /**
* Convert from "Lat,Long Lat,Long" String format
* "Lat,Long,Lat,Long" Format
* or all four entries "Lat Long Lat Long"
- *
+ *
* (Convenience function)
- *
+ *
* Since Distance is positive, a "-1" indicates an error in String formatting
*/
public static double calc(String ... coords) {
@@ -111,7 +111,7 @@ public class GreatCircle {
Double.parseDouble(coords[2]),
Double.parseDouble(coords[3])
);
-
+
default:
return -1;
}
@@ -124,7 +124,7 @@ public class GreatCircle {
///**
//* Haverside method, from Princeton
-//*
+//*
//* @param alat
//* @param alon
//* @param blat
@@ -169,16 +169,16 @@ public class GreatCircle {
// alon *= DEGREES_2_RADIANS;
// blat *= DEGREES_2_RADIANS;
// blon *= DEGREES_2_RADIANS;
-//
+//
// // Reused values
// double cosAlat,cosBlat;
-//
+//
// return Math.acos(
// ((cosAlat=Math.cos(alat))*Math.cos(alon)*(cosBlat=Math.cos(blat))*Math.cos(blon)) +
// (cosAlat*Math.sin(alon)*cosBlat*Math.sin(blon)) +
// (Math.sin(alat)*Math.sin(blat))
// )/DEGREES_2_RADIANS;
-//
+//
//}
/*
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java
index 65daa7b6..9c293c92 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,20 +34,20 @@ import java.io.PrintStream;
import java.net.HttpURLConnection;
public class JU_AbsAuthentication {
-
+
private final static String ID = "id";
private final static String PASSWORD = "password";
private final static String WARNING = "Your service has 1000 consecutive bad service " +
"logins to AAF. AAF Access will be disabled after 10000\n";
-
+
private static ByteArrayOutputStream errStream;
-
+
@Before
public void setup() {
errStream = new ByteArrayOutputStream();
System.setErr(new PrintStream(errStream));
}
-
+
@After
public void tearDown() {
System.setErr(System.err);
@@ -59,7 +59,7 @@ public class JU_AbsAuthentication {
assertThat(stub.getID(), is(nullValue()));
assertThat(stub.headValue(), is(""));
assertThat(stub.count(), is(0));
-
+
stub.setUser(ID);
assertThat(stub.getID(), is(ID));
@@ -67,7 +67,7 @@ public class JU_AbsAuthentication {
assertThat(stub.getID(), is(ID));
assertThat(stub.headValue(), is(PASSWORD));
assertThat(stub.count(), is(0));
-
+
assertThat(stub.setLastResponse(200), is(0));
assertThat(stub.isDenied(), is(false));
@@ -81,12 +81,12 @@ public class JU_AbsAuthentication {
stub.setCount(999);
assertThat(stub.setLastResponse(401), is(1000));
assertThat(errStream.toString(), is(WARNING));
-
+
// coverage...
stub.setLastMiss(1);
assertThat(stub.isDenied(), is(false));
}
-
+
private class AuthStub extends AbsAuthentication<HttpURLConnection> {
public AuthStub(SecurityInfoC<HttpURLConnection> securityInfo, String user, byte[] headValue)
@@ -95,7 +95,7 @@ public class JU_AbsAuthentication {
@Override public void setSecurity(HttpURLConnection client) throws CadiException { }
@Override public void setUser(String id) { super.setUser(id); }
@Override public String headValue() throws IOException { return super.headValue(); }
-
+
public void setLastMiss(long lastMiss) { this.lastMiss = lastMiss; }
public void setCount(int count) { this.count = count; }
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java
index c7720775..6d09b379 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,18 +34,18 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
import java.net.HttpURLConnection;
public class JU_AbsTransferSS {
-
+
@Mock TaggedPrincipal princMock;
@Mock SecurityInfoC<HttpURLConnection> siMock;
-
+
private static final String princName = "name";
private static final String princTag = "tag";
private static final String app = "app";
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
-
+
when(princMock.getName()).thenReturn(princName);
when(princMock.tag()).thenReturn(princTag);
}
@@ -55,12 +55,12 @@ public class JU_AbsTransferSS {
TransferSSStub stub = new TransferSSStub(princMock, app);
assertThat(stub.getID(), is(princName));
assertThat(stub.getValue(), is(princName + ':' + app + ':' + princTag + ':' + "AS"));
-
+
stub = new TransferSSStub(null, app, siMock);
assertThat(stub.getID(), is(""));
assertThat(stub.getValue(), is(nullValue()));
}
-
+
private class TransferSSStub extends AbsTransferSS<HttpURLConnection> {
public TransferSSStub(TaggedPrincipal principal, String app) { super(principal, app); }
public TransferSSStub(TaggedPrincipal principal, String app, SecurityInfoC<HttpURLConnection> si) { super(principal, app, si); }
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java
index 97fa9d21..a631dfbc 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,11 +34,11 @@ public class JU_Future {
@SuppressWarnings("unused")
Future<Integer> f = new FutureStub();
}
-
+
private class FutureStub extends Future<Integer> {
- @Override public boolean get(int timeout) throws CadiException { return false; }
- @Override public int code() { return 0; }
- @Override public String body() { return null; }
+ @Override public boolean get(int timeout) throws CadiException { return false; }
+ @Override public int code() { return 0; }
+ @Override public String body() { return null; }
@Override public String header(String tag) { return null; }
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java
index 6412d243..d8c5a598 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@ public class JU_Holder {
Holder<String> holder = new Holder<String>(str1);
assertThat(holder.get(), is(str1));
assertThat(holder.toString(), is(str1));
-
+
holder.set(str2);
assertThat(holder.get(), is(str2));
assertThat(holder.toString(), is(str2));
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java
index d33811e3..8fe0190c 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -61,24 +61,24 @@ public class JU_Rcli {
@Mock HttpServletRequest reqMock;
@Mock HttpServletResponse respMock;
@Mock ServletInputStream isMock;
-
+
private final static String uriString = "example.com";
private final static String apiVersion = "v1.0";
private final static String contentType = "contentType";
-
+
private static URI uri;
private static Enumeration<String> enumeration;
private Client client;
-
+
@Before
public void setup() throws URISyntaxException, IOException {
MockitoAnnotations.initMocks(this);
-
+
when(dfMock.getTypeClass()).thenReturn(HttpURLConnection.class);
when(dfMock.newData()).thenReturn(dataMock);
when(dataMock.out((TYPE) any())).thenReturn(dataMock);
-
+
when(reqMock.getInputStream()).thenReturn(isMock);
when(isMock.read((byte[]) any())).thenReturn(-1);
@@ -86,7 +86,7 @@ public class JU_Rcli {
enumeration = new CustomEnumeration();
client = new Client();
}
-
+
@Test
public void createTest() throws APIException, CadiException {
RcliStub rcli = new RcliStub(uri);
@@ -112,7 +112,7 @@ public class JU_Rcli {
rcli.create("No question mark", contentType);
rcli.create("question?mark", contentType);
}
-
+
@Test
public void postFormTest() throws APIException, CadiException {
RcliStub rcli = new RcliStub(uri);
@@ -121,7 +121,7 @@ public class JU_Rcli {
rcli.postForm(null, dfMock);
rcli.postForm("No question mark", dfMock);
rcli.postForm("question?mark", dfMock);
-
+
rcli.type(Data.TYPE.JSON);
rcli.postForm("question?mark", dfMock);
@@ -145,7 +145,7 @@ public class JU_Rcli {
rcli.readPost("First string", "Second string");
}
-
+
@Test
public void readTest() throws APIException, CadiException {
RcliStub rcli = new RcliStub(uri);
@@ -189,7 +189,7 @@ public class JU_Rcli {
when(reqMock.getRequestURI()).thenReturn(uriString);
when(reqMock.getHeaderNames()).thenReturn(enumeration);
rcli.transfer(reqMock, respMock, "string", 200);
-
+
// coverage...
when(reqMock.getMethod()).thenReturn("GET");
rcli.transfer(reqMock, respMock, "string", 200);
@@ -207,13 +207,13 @@ public class JU_Rcli {
public void accessorMutatorTest() throws URISyntaxException {
RcliStub rcli = new RcliStub();
Rcli<?> rcliClone = rcli.forUser(null);
-
+
rcli = new RcliStub(uri);
assertThat(rcli.toString(), is(uriString));
assertThat(rcli.getURI(), is(uri));
assertThat(rcli.getReadTimeout(), is(5000));
assertThat(rcli.getConnectionTimeout(), is(3000));
-
+
rcli.connectionTimeout(3001);
assertThat(rcli.getConnectionTimeout(), is(3001));
rcli.readTimeout(5001);
@@ -224,7 +224,7 @@ public class JU_Rcli {
assertThat(rcli.typeString(HttpURLConnection.class), is("application/HttpURLConnection+xml;version=" + apiVersion));
rcli.apiVersion(null);
assertThat(rcli.typeString(HttpURLConnection.class), is("application/HttpURLConnection+xml"));
-
+
rcliClone = rcli.forUser(null);
assertThat(rcliClone.toString(), is(uriString));
}
@@ -232,15 +232,15 @@ public class JU_Rcli {
private class RcliStub extends Rcli<HttpURLConnection> {
public RcliStub() { super(); }
public RcliStub(URI uri) { this.uri = uri; }
- @Override public void setSecuritySetter(SecuritySetter<HttpURLConnection> ss) { }
- @Override public SecuritySetter<HttpURLConnection> getSecuritySetter() { return null; }
- @Override protected Rcli<HttpURLConnection> clone(URI uri, SecuritySetter<HttpURLConnection> ss) { return this; }
- @Override public void invalidate() throws CadiException { }
- @Override protected EClient<HttpURLConnection> client() throws CadiException { return client; }
+ @Override public void setSecuritySetter(SecuritySetter<HttpURLConnection> ss) { }
+ @Override public SecuritySetter<HttpURLConnection> getSecuritySetter() { return null; }
+ @Override protected Rcli<HttpURLConnection> clone(URI uri, SecuritySetter<HttpURLConnection> ss) { return this; }
+ @Override public void invalidate() throws CadiException { }
+ @Override protected EClient<HttpURLConnection> client() throws CadiException { return client; }
public int getReadTimeout() { return readTimeout; }
public int getConnectionTimeout() { return connectionTimeout; }
}
-
+
private class CustomEnumeration implements Enumeration<String> {
private int idx = 0;
private final String[] elements = {"This", "is", "a", "test"};
@@ -257,11 +257,11 @@ public class JU_Rcli {
private class Client implements EClient<HttpURLConnection> {
private Transfer transfer;
@Override public void setPayload(Transfer transfer) { this.transfer = transfer; }
- @Override public void setMethod(String meth) { }
- @Override public void setPathInfo(String pathinfo) { }
- @Override public void addHeader(String tag, String value) { }
- @Override public void setQueryParams(String q) { }
- @Override public void setFragment(String f) { }
+ @Override public void setMethod(String meth) { }
+ @Override public void setPathInfo(String pathinfo) { }
+ @Override public void addHeader(String tag, String value) { }
+ @Override public void setQueryParams(String q) { }
+ @Override public void setFragment(String f) { }
@Override public void send() throws APIException {
try {
if (transfer != null) {
@@ -269,14 +269,14 @@ public class JU_Rcli {
}
} catch (IOException e) {
}
- }
- @Override public <T> Future<T> futureCreate(Class<T> t) { return null; }
- @Override public Future<String> futureReadString() { return null; }
- @Override public <T> Future<T> futureRead(RosettaDF<T> df, TYPE type) { return null; }
- @Override public <T> Future<T> future(T t) { return null; }
- @Override public Future<Void> future(HttpServletResponse resp, int expected) throws APIException { return null; }
+ }
+ @Override public <T> Future<T> futureCreate(Class<T> t) { return null; }
+ @Override public Future<String> futureReadString() { return null; }
+ @Override public <T> Future<T> futureRead(RosettaDF<T> df, TYPE type) { return null; }
+ @Override public <T> Future<T> future(T t) { return null; }
+ @Override public Future<Void> future(HttpServletResponse resp, int expected) throws APIException { return null; }
}
-
+
//private class FutureStub implements Future<String> {
//}
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java
index 41570980..1da04064 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,7 +28,7 @@ import org.junit.*;
import org.onap.aaf.cadi.client.Result;
public class JU_Result {
-
+
private static final int OK = 200;
private static final int NOT_FOUND = 404;
@@ -38,7 +38,7 @@ public class JU_Result {
result = Result.ok(OK, 10);
assertThat(result.toString(), is("Code: 200"));
assertThat(result.isOK(), is(true));
-
+
result = Result.err(NOT_FOUND, "File not found");
assertThat(result.toString(), is("Code: 404 = File not found"));
assertThat(result.isOK(), is(false));
@@ -47,5 +47,5 @@ public class JU_Result {
assertThat(result.toString(), is("Code: 404 = File not found"));
assertThat(result.isOK(), is(false));
}
-
+
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java
index 200b393d..b876710d 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,10 +40,10 @@ public class JU_Retryable {
RetryableStub retry = new RetryableStub();
assertThat(retry.item(), is(nullValue()));
assertThat(retry.lastClient(), is(nullValue()));
-
+
Locator.Item item = null;
assertThat(retry.item(item), is(item));
-
+
retry = new RetryableStub(retry);
assertThat(retry.item(), is(nullValue()));
assertThat(retry.lastClient(), is(nullValue()));
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java
index 4bb44e10..c2f75002 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,10 +41,10 @@ public class JU_HAuthorizationHeader {
@Mock
HttpsURLConnection hucsMock;
-
+
@Mock
HttpURLConnection hucMock;
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
@@ -59,7 +59,7 @@ public class JU_HAuthorizationHeader {
header = new HAuthorizationHeader(null, null, null);
header.setSecurity(hucsMock);
}
-
+
@Test(expected = CadiException.class)
public void throwsWhenDeniedTest() throws CadiException, IOException {
HAuthorizationHeader header = new HAuthorizationHeader(siMock, "string1", "string2") {
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java
index d0655979..9d3b5a4e 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,23 +39,23 @@ import org.onap.aaf.cadi.http.HSecurityInfoInit;
import org.onap.aaf.cadi.principal.BasicPrincipal;
public class JU_HBasicAuthSS {
-
+
@Mock
BasicPrincipal bpMock;
-
+
private SecurityInfoC<HttpURLConnection> si;
private PropAccess access;
-
+
private final static String id = "id";
private final static String password = "password";
-
+
@Before
public void setup() throws CadiException, IOException {
MockitoAnnotations.initMocks(this);
-
+
when(bpMock.getName()).thenReturn(id);
when(bpMock.getCred()).thenReturn(password.getBytes());
-
+
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
access.setProperty(Config.AAF_APPID, id);
access.setProperty(Config.AAF_APPPASS, access.encrypt(password));
@@ -68,7 +68,7 @@ public class JU_HBasicAuthSS {
// All the constructors accomplish the same thing
@SuppressWarnings("unused")
HBasicAuthSS auth = new HBasicAuthSS(si);
-
+
// TODO: While these test _should_ pass, and they _do_ pass on my local machine, they won't
// pass when then onap jobbuilder runs them. Good luck!
// assertThat(auth.getID(), is(id));
@@ -84,10 +84,10 @@ public class JU_HBasicAuthSS {
auth = new HBasicAuthSS(bpMock, si);
// assertThat(auth.getID(), is(id));
-
+
auth = new HBasicAuthSS(bpMock, si, false);
// assertThat(auth.getID(), is(id));
-
+
auth = new HBasicAuthSS(bpMock, si, true);
// assertThat(auth.getID(), is(id));
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java
index c32abe43..c224676c 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java
@@ -99,7 +99,7 @@ public class JU_HClient {
HClientStub client;
client = new HClientStub(ssMock, uri, 0, null);
client.send();
-
+
client.setPathInfo("/pathinfo");
client.send();
@@ -116,7 +116,7 @@ public class JU_HClient {
client.setPayload(transferMock);
client.send();
}
-
+
@Test(expected = APIException.class)
public void sendThrows1Test() throws APIException, LocatorException, URISyntaxException {
HClientStub client = new HClientStub(ssMock, new URI("mailto:me@domain.com"), 0, null);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java
index 10eb8184..98070d6b 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -58,14 +58,14 @@ import org.onap.aaf.misc.env.APIException;
import junit.framework.Assert;
public class JU_HMangr {
-
+
@Mock Locator<URI> locMock;
@Mock SecuritySetter<HttpURLConnection> ssMock;
@Mock Retryable<Void> retryableMock;
@Mock Retryable<Integer> goodRetry;
@Mock Locator.Item itemMock;
@Mock Rcli<Object> clientMock;
-
+
private PropAccess access;
private URI uri;
private final static String uriString = "http://example.com";
@@ -84,11 +84,11 @@ public class JU_HMangr {
when(retryableMock.item()).thenReturn(itemMock);
when(locMock.get(itemMock)).thenReturn(uri);
assertThat(hman.same(ssMock, retryableMock), is(nullValue()));
-
+
//coverage...
when(retryableMock.lastClient()).thenReturn(clientMock);
assertThat(hman.same(ssMock, retryableMock), is(nullValue()));
-
+
CadiException cadiException;
ConnectException connectException = new ConnectException();
@@ -210,7 +210,7 @@ public class JU_HMangr {
assertThat(hman.oneOf(ssMock, retryableMock, false, "host"), is(nullValue()));
assertThat(hman.oneOf(ssMock, retryableMock, false, uriString.substring(7)), is(nullValue()));
-
+
CadiException cadiException;
cadiException = new CadiException(new ConnectException());
@@ -244,7 +244,7 @@ public class JU_HMangr {
fail("Should've thrown an exception");
} catch (CadiException e) {
}
-
+
doThrow(new ConnectException()).when(retryableMock).code((Rcli<?>) any());
assertThat(hman.oneOf(ssMock, retryableMock, false, uriString.substring(7)), is(nullValue()));
@@ -274,5 +274,5 @@ public class JU_HMangr {
return null;
}
}
-
+
} \ No newline at end of file
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java
index 923dd1a0..e1a1e70b 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,21 +33,21 @@ import org.onap.aaf.cadi.config.SecurityInfoC;
import org.onap.aaf.cadi.http.HNoAuthSS;
public class JU_HNoAuthSS {
-
+
@Mock
SecurityInfoC<HttpURLConnection> siMock;
-
+
@Mock
HttpURLConnection httpMock;
@Mock
HttpsURLConnection httpsMock;
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
}
-
+
@Test
public void test() throws IOException, CadiException {
HNoAuthSS noAuth = new HNoAuthSS(null);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java
index ab6a39c0..92f7dd63 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,22 +44,22 @@ import org.onap.aaf.cadi.http.HMangr;
import org.onap.aaf.cadi.http.HRcli;
public class JU_HRcli {
-
+
@Mock
SecuritySetter<HttpURLConnection> ssMock;
-
+
@Mock
Locator<URI> locMock;
-
+
@Mock
Locator.Item itemMock;
-
+
private HMangr hman;
private PropAccess access;
private static URI uri;
-
+
private static final String uriString = "example.com";
-
+
@Before
public void setup() throws LocatorException, URISyntaxException {
MockitoAnnotations.initMocks(this);
@@ -79,20 +79,20 @@ public class JU_HRcli {
hrcli.setSecuritySetter(ssMock);
assertThat(hrcli.getSecuritySetter(), is(ssMock));
-
+
// No throw
hrcli.invalidate();
// Throw
doThrow(CadiException.class).when(locMock).invalidate(itemMock);
hrcli.invalidate();
}
-
+
@Test(expected = CadiException.class)
public void protectedInterfaceTest() throws CadiException, LocatorException {
HRcliStub hrcli = new HRcliStub(hman, uri, itemMock, ssMock);
HRcli clone = hrcli.clone(uri, ssMock);
assertThat(clone.toString(), is(hrcli.toString()));
-
+
EClient<HttpURLConnection> eclient = hrcli.client();
assertThat(eclient, is(not(nullValue())));
@@ -105,7 +105,7 @@ public class JU_HRcli {
when(locMock.best()).thenReturn(null);
eclient = hrcli.client();
}
-
+
private class HRcliStub extends HRcli {
public HRcliStub(HMangr hman, URI uri, Item locItem, SecuritySetter<HttpURLConnection> secSet) {
super(hman, uri, locItem, secSet);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java
index 9f2c9a71..eaf668e0 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,7 +36,7 @@ public class JU_HTokenSS {
@Mock
SecurityInfoC<HttpURLConnection> siMock;
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java
index 77fac567..809863e4 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,10 +41,10 @@ import org.onap.aaf.cadi.http.HTransferSS;
import org.onap.aaf.cadi.principal.TaggedPrincipal;
public class JU_HTransferSS {
-
+
@Mock
TaggedPrincipal princMock;
-
+
@Mock
HttpURLConnection hucMock;
@@ -53,15 +53,15 @@ public class JU_HTransferSS {
@Mock
SecurityInfoC<HttpURLConnection> siMock;
-
+
@Mock
SecurityInfoC<HttpURLConnection> siMockNoDefSS;
@Mock
SecuritySetter<HttpURLConnection> ssMock;
-
+
private static final String princName = "name";
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
@@ -73,7 +73,7 @@ public class JU_HTransferSS {
public void test() throws IOException, CadiException {
HTransferSS transfer = new HTransferSS(princMock, "string1");
assertThat(transfer.setLastResponse(0), is(0));
-
+
transfer = new HTransferSS(princMock, "string1", siMock);
transfer.setSecurity(hucsMock);
assertThat(transfer.getID(), is(princName));
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java
index fd102a95..f85697ae 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -48,33 +48,33 @@ import org.onap.aaf.cadi.http.HX509SS;
import org.onap.aaf.misc.env.APIException;
public class JU_HX509SS {
-
+
@Mock X509Certificate x509Mock;
@Mock X509KeyManager keyManagerMock;
@Mock PrivateKey privateKeyMock;
@Mock SecurityInfoC<HttpURLConnection> siMock;
@Mock HttpURLConnection hucMock;
@Mock HttpsURLConnection hucsMock;
-
+
private final static String alias = "Some alias";
private final static String algName = "Some algName";
private final static byte[] publicKeyBytes = "a public key".getBytes();
-
+
private PropAccess access;
private SecurityInfoC<HttpURLConnection> si;
-
+
@Before
public void setup() throws IOException, CadiException, CertificateEncodingException {
MockitoAnnotations.initMocks(this);
-
+
when(x509Mock.getSigAlgName()).thenReturn(algName);
when(x509Mock.getEncoded()).thenReturn(publicKeyBytes);
-
+
when(keyManagerMock.getCertificateChain(alias)).thenReturn(new X509Certificate[] {x509Mock});
when(keyManagerMock.getPrivateKey(alias)).thenReturn(privateKeyMock);
when(siMock.getKeyManagers()).thenReturn(new X509KeyManager[] {keyManagerMock});
-
+
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
access.setProperty(Config.CADI_ALIAS, alias);
// si = SecurityInfoC.instance(access, HttpURLConnectionStub.class);
@@ -87,12 +87,12 @@ public class JU_HX509SS {
assertThat(x509.setLastResponse(0), is(0));
assertThat(x509.setLastResponse(1), is(0));
assertThat(x509.setLastResponse(2), is(0));
-
+
// coverage...
x509.setSecurity(hucMock);
x509.setSecurity(hucsMock);
}
-
+
// TODO: Test the setSecurity method - Ian
// @Test
// public void test2() throws APIException, CadiException {
@@ -100,7 +100,7 @@ public class JU_HX509SS {
// x509.setSecurity(hucMock);
// x509.setSecurity(hucsMock);
// }
-
+
@Test(expected = APIException.class)
public void throws1Test() throws APIException, CadiException {
@SuppressWarnings("unused")
@@ -113,5 +113,5 @@ public class JU_HX509SS {
@SuppressWarnings("unused")
HX509SS x509 = new HX509SS(alias, siMock);
}
-
+
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java
index b786cf68..e2c8f828 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,9 +38,9 @@ import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.locator.DNSLocator;
public class JU_DNSLocator {
-
+
private PropAccess access;
-
+
@Before
public void setup() {
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
@@ -53,7 +53,7 @@ public class JU_DNSLocator {
URI uri;
dl = new DNSLocator(access, "https", "localhost", "8100-8101");
-
+
item = dl.best();
uri = dl.get(item);
assertThat(uri.toString(), is("https://localhost:8100"));
@@ -66,10 +66,10 @@ public class JU_DNSLocator {
}
assertThat(dl.hasItems(), is(false));
- // This doesn't actually do anything besides increase coverage
+ // This doesn't actually do anything besides increase coverage
dl.destroy();
}
-
+
@Test
public void constructorTest() throws LocatorException {
// For coverage
@@ -84,20 +84,20 @@ public class JU_DNSLocator {
new DNSLocator(access, "https://localhost:8000/");
new DNSLocator(access, "https://aaf-locatexx.onapxxx:8095/locate");
try {
- new DNSLocator(access, "https:localhost:8000");
- fail("Invalid URL should not pass");
+ new DNSLocator(access, "https:localhost:8000");
+ fail("Invalid URL should not pass");
} catch (LocatorException e) {
- access.log(Level.DEBUG, "Valid Exception");
-
+ access.log(Level.DEBUG, "Valid Exception");
+
}
}
-
+
@Test
public void refreshTest() throws LocatorException {
DNSLocator dl = new DNSLocator(access, "https", "bogushost", "8100-8101");
assertThat(dl.refresh(), is(false));
}
-
+
@Test(expected = LocatorException.class)
public void throws1Test() throws LocatorException {
new DNSLocator(access, null);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java
index d85a84a2..496017a8 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java
@@ -86,7 +86,7 @@ public class JU_HClientHotPeerLocator {
item = loc.first();
loc.invalidate(item);
-
+
loc.invalidate(loc.bestClient());
loc.invalidate(loc.get(loc.next(item)));
loc.destroy();
@@ -106,13 +106,13 @@ public class JU_HClientHotPeerLocator {
assertThat(alternate2, is("Alternate Client is " + goodURL2));
outStream.reset();
-
+
loc.invalidate(loc.first());
loc.destroy();
loc.best();
}
-
+
@Test
public void hasNoItemTest() throws LocatorException {
HClientHotPeerLocator loc;
@@ -134,7 +134,7 @@ public class JU_HClientHotPeerLocator {
loc = new CoverageLocator(access, urlStr, 0, "38.627", "-90.199", ssMock);
assertThat(loc._invalidate(null), is(nullValue()));
loc._destroy(null);
-
+
loc._newClient("bad string");
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java
index 0eae1198..26673dd5 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -85,7 +85,7 @@ public class JU_PropertyLocator {
pl.refresh();
assertThat(pl.hasItems(), is(true));
-
+
assertThat(pl.next(null), is(nullValue()));
// coverage...
@@ -97,7 +97,7 @@ public class JU_PropertyLocator {
pl.destroy();
pl = new PropertyLocator(uris);
-
+
}
@Test(expected=LocatorException.class)
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java b/cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java
index 31fda501..1cc74e56 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java b/cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java
index 575bc2ee..ef26f475 100644
--- a/cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java
+++ b/cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,7 +52,7 @@ public class JU_ResultTest {
assertFalse(t.isOK());
assertThat(t.toString(), is("Code: 1 = Error Body"));
}
-
+
@Test
public void testOk1() {
Result<String> t = Result.ok(1, "Ok");
@@ -70,7 +70,7 @@ public class JU_ResultTest {
assertFalse(t.isOK());
assertThat(t.toString(), is("Code: 1 = Error Body"));
}
-
+
@Test
public void testOk2() {
Result<String> t = Result.ok(1, "Ok");
@@ -88,7 +88,7 @@ public class JU_ResultTest {
assertFalse(t.isOK());
assertThat(t.toString(), is("Code: 1 = Error Body"));
}
-
+
@Test
public void testOk3() {
Result<String> t = Result.ok(1, "Ok");
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/AES.java b/cadi/core/src/main/java/org/onap/aaf/cadi/AES.java
index 4ec51682..d32df881 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/AES.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/AES.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,14 +47,14 @@ import org.onap.aaf.cadi.util.Chmod;
* AES Class wraps Cipher AES, 128
* NOTE: While not explicitly stated in JavaDocs, Ciphers AND SecretKeySpecs are NOT ThreadSafe
* Ciphers take time to create, therefore, we have pooled them.
- *
+ *
* @author Jonathan
*
*/
public class AES implements Encryption {
public static final String AES = AES.class.getSimpleName();
public static final int AES_KEY_SIZE = 128; // 256 isn't supported on all JDKs.
-
+
private SecretKeySpec aeskeySpec;
public static SecretKey newKey() throws NoSuchAlgorithmException {
@@ -66,7 +66,7 @@ public class AES implements Encryption {
public AES(byte[] aeskey, int offset, int len){
aeskeySpec = new SecretKeySpec(aeskey,offset,len,AES);
}
-
+
public byte[] encrypt(byte[] in) throws CadiException {
try {
Cipher c = Cipher.getInstance(AES);
@@ -76,17 +76,17 @@ public class AES implements Encryption {
throw new CadiException(e);
}
}
-
+
public byte[] decrypt(byte[] in) throws CadiException {
try {
Cipher c = Cipher.getInstance(AES);
- c.init(Cipher.DECRYPT_MODE,aeskeySpec);
+ c.init(Cipher.DECRYPT_MODE,aeskeySpec);
return c.doFinal(in);
} catch (InvalidKeyException | IllegalBlockSizeException | BadPaddingException | NoSuchAlgorithmException | NoSuchPaddingException e) {
throw new CadiException(e);
}
}
-
+
public void save(File keyfile) throws IOException {
FileOutputStream fis = new FileOutputStream(keyfile);
try {
@@ -112,7 +112,7 @@ public class AES implements Encryption {
return null; // should never get here.
}
}
-
+
public CipherInputStream inputStream(InputStream is, boolean encrypt) {
try {
Cipher c = Cipher.getInstance(AES);
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java b/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java
index e6d24dab..561995de 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,11 +39,11 @@ import org.onap.aaf.cadi.principal.CachedBasicPrincipal;
/**
* Implement Fast lookup and Cache for Local User Info
- *
+ *
* Include ability to add and remove Users
- *
+ *
* Also includes a Timer Thread (when necessary) to invoke cleanup on expiring Credentials
- *
+ *
* @author Jonathan
*
*/
@@ -57,10 +57,10 @@ public abstract class AbsUserCache<PERM extends Permission> {
private final Map<String, User<PERM>> userMap;
private static final Map<String, Miss> missMap = new TreeMap<>();
private final Symm missEncrypt;
-
+
private Clean clean;
protected Access access;
-
+
protected AbsUserCache(Access access, long cleanInterval, int highCount, int usageCount) {
this.access = access;
Symm s;
@@ -72,29 +72,29 @@ public abstract class AbsUserCache<PERM extends Permission> {
s = Symm.base64noSplit;
}
missEncrypt = s;
-
+
userMap = new ConcurrentHashMap<>();
-
+
if (cleanInterval>0) {
cleanInterval = Math.max(MIN_INTERVAL, cleanInterval);
synchronized(AbsUserCache.class) { // Lazy instantiate.. in case there is no cleanup needed
if (timer==null) {
timer = new Timer("CADI Cleanup Timer",true);
}
-
+
timer.schedule(clean = new Clean(access, cleanInterval, highCount, usageCount), cleanInterval, cleanInterval);
access.log(Access.Level.INIT, "Cleaning Thread initialized with interval of",cleanInterval, "ms and max objects of", highCount);
}
}
}
-
+
@SuppressWarnings("unchecked")
public AbsUserCache(AbsUserCache<PERM> cache) {
this.access = cache.access;
userMap = cache.userMap;
missEncrypt = cache.missEncrypt;
-
+
synchronized(AbsUserCache.class) {
if (cache.clean!=null && cache.clean.lur==null && this instanceof CachingLur) {
cache.clean.lur=(CachingLur<PERM>)this;
@@ -104,9 +104,9 @@ public abstract class AbsUserCache<PERM extends Permission> {
protected void setLur(CachingLur<PERM> lur) {
if (clean!=null)clean.lur = lur;
-
+
}
-
+
protected void addUser(User<PERM> user) {
Principal p = user.principal;
String key;
@@ -132,16 +132,16 @@ public abstract class AbsUserCache<PERM extends Permission> {
protected void addUser(String key, User<PERM> user) {
userMap.put(key, user);
}
-
+
/**
* Add miss to missMap. If Miss exists, or too many tries, returns false.
- *
+ *
* otherwise, returns true to allow another attempt.
- *
+ *
* @param key
* @param bs
* @return
- * @throws IOException
+ * @throws IOException
*/
protected synchronized boolean addMiss(String key, byte[] bs) {
String mkey;
@@ -156,7 +156,7 @@ public abstract class AbsUserCache<PERM extends Permission> {
missMap.put(mkey, new Miss(bs,clean==null?MIN_INTERVAL:clean.timeInterval,key));
return true;
}
- return miss.mayContinue();
+ return miss.mayContinue();
}
protected Miss missed(String key, byte[] bs) throws IOException {
@@ -182,11 +182,11 @@ public abstract class AbsUserCache<PERM extends Permission> {
}
return u;
}
-
+
protected User<PERM> getUser(CachedBasicPrincipal cbp) {
return getUser(cbp.getName(), cbp.getCred());
}
-
+
protected User<PERM> getUser(String user, byte[] cred) {
User<PERM> u;
String key=null;
@@ -207,7 +207,7 @@ public abstract class AbsUserCache<PERM extends Permission> {
}
return u;
}
-
+
/**
* Removes User from the Cache
* @param user
@@ -215,10 +215,10 @@ public abstract class AbsUserCache<PERM extends Permission> {
protected void remove(User<PERM> user) {
userMap.remove(user.principal.getName());
}
-
+
/**
* Removes user from the Cache
- *
+ *
* @param user
*/
public void remove(String user) {
@@ -227,14 +227,14 @@ public abstract class AbsUserCache<PERM extends Permission> {
access.log(Level.INFO, user,"removed from Client Cache by Request");
}
}
-
+
/**
* Clear all Users from the Client Cache
*/
public void clearAll() {
userMap.clear();
}
-
+
public final List<DumpInfo> dumpInfo() {
List<DumpInfo> rv = new ArrayList<>();
for (User<PERM> user : userMap.values()) {
@@ -249,10 +249,10 @@ public abstract class AbsUserCache<PERM extends Permission> {
public boolean handlesExclusively(Permission ... pond) {
return false;
}
-
+
/**
- * Container calls when cleaning up...
- *
+ * Container calls when cleaning up...
+ *
* If overloading in Derived class, be sure to call "super.destroy()"
*/
public void destroy() {
@@ -261,8 +261,8 @@ public abstract class AbsUserCache<PERM extends Permission> {
timer.cancel();
}
}
-
-
+
+
// Simple map of Group name to a set of User Names
// private Map<String, Set<String>> groupMap = new HashMap<>();
@@ -273,34 +273,34 @@ public abstract class AbsUserCache<PERM extends Permission> {
public final class DumpInfo {
public String user;
public List<String> perms;
-
+
public DumpInfo(User<PERM> user) {
this.user = user.principal.getName();
perms = new ArrayList<>(user.perms.keySet());
}
}
-
+
/**
* Clean will examine resources, and remove those that have expired.
- *
+ *
* If "highs" have been exceeded, then we'll expire 10% more the next time. This will adjust after each run
* without checking contents more than once, making a good average "high" in the minimum speed.
- *
+ *
* @author Jonathan
*
*/
private final class Clean extends TimerTask {
private final Access access;
private CachingLur<PERM> lur;
-
- // The idea here is to not be too restrictive on a high, but to Expire more items by
+
+ // The idea here is to not be too restrictive on a high, but to Expire more items by
// shortening the time to expire. This is done by judiciously incrementing "advance"
// when the "highs" are exceeded. This effectively reduces numbers of cached items quickly.
private final int high;
private long advance;
private final long timeInterval;
private final int usageTriggerCount;
-
+
public Clean(Access access, long cleanInterval, int highCount, int usageTriggerCount) {
this.access = access;
lur = null;
@@ -342,7 +342,7 @@ public abstract class AbsUserCache<PERM extends Permission> {
}
}
}
-
+
if (!removed && lur!=null && user.permExpires<= now ) {
if (lur.reload(user).equals(Resp.REVALIDATED)) {
user.renewPerm();
@@ -354,7 +354,7 @@ public abstract class AbsUserCache<PERM extends Permission> {
if (touched) {
++renewed;
}
-
+
} else {
if (user.permExpired()) {
remove(user);
@@ -362,7 +362,7 @@ public abstract class AbsUserCache<PERM extends Permission> {
}
}
}
-
+
// Clean out Misses
int missTotal = missMap.keySet().size();
int miss = 0;
@@ -385,12 +385,12 @@ public abstract class AbsUserCache<PERM extends Permission> {
}
}
}
-
+
if (count+renewed+miss>0) {
access.log(Level.INFO, (lur==null?"Cache":lur.getClass().getSimpleName()), "removed",count,
"and renewed",renewed,"expired Permissions out of", total,"and removed", miss, "password misses out of",missTotal);
}
-
+
// If High (total) is reached during this period, increase the number of expired services removed for next time.
// There's no point doing it again here, as there should have been cleaned items.
if (total>high) {
@@ -421,17 +421,17 @@ public abstract class AbsUserCache<PERM extends Permission> {
private long tries;
private final String name;
-
+
public Miss(final byte[] first, final long timeInterval, final String name) {
timestamp = System.currentTimeMillis() + timeInterval;
this.timetolive = timeInterval;
tries = 0L;
this.name = name;
}
-
-
+
+
public synchronized boolean mayContinue() {
- long ts = System.currentTimeMillis();
+ long ts = System.currentTimeMillis();
if (ts>timestamp) {
tries = 0;
timestamp = ts + timetolive;
@@ -440,20 +440,20 @@ public abstract class AbsUserCache<PERM extends Permission> {
}
return true;
}
-
+
}
-
+
/**
* Report on state
*/
public String toString() {
- return getClass().getSimpleName() +
+ return getClass().getSimpleName() +
" Cache:\n Users Cached: " +
userMap.size() +
"\n Misses Saved: " +
missMap.size() +
'\n';
-
+
}
public void clear(Principal p, StringBuilder sb) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Access.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Access.java
index a673ab4f..4009521c 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Access.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Access.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,8 +29,8 @@ import java.util.Properties;
* Various Environments require different logging mechanisms, or at least allow
* for different ones. We need the Framework to be able to hook into any particular instance of logging
* mechanism, whether it be a Logging Object within a Servlet Context, or a direct library like log4j.
- * This interface, therefore, allows maximum pluggability in a variety of different app styles.
- *
+ * This interface, therefore, allows maximum pluggability in a variety of different app styles.
+ *
* @author Jonathan
*
*/
@@ -39,15 +39,15 @@ public interface Access {
public enum Level {
DEBUG(0x1), INFO(0x10), AUDIT(0x100), WARN(0x2000), ERROR(0x4000), INIT(0x8000),TRACE(0x10000),NONE(0XFFFF);
private final int bit;
-
+
Level(int ord) {
bit = ord;
}
-
+
public boolean inMask(int mask) {
return (mask & bit) == bit;
}
-
+
public int addToMask(int mask) {
return mask | bit;
}
@@ -89,8 +89,8 @@ public interface Access {
* @param elements
*/
public void printf(Level level, String fmt, Object ... elements);
-
- /**
+
+ /**
* Check if message will log before constructing
* @param level
* @return
@@ -98,24 +98,24 @@ public interface Access {
public boolean willLog(Level level);
/**
- * Write the contents of an exception, followed by a variable list of Object's text via the
+ * Write the contents of an exception, followed by a variable list of Object's text via the
* toString() method with appropriate space, etc.
- *
+ *
* The Loglevel is always "ERROR"
- *
+ *
* @param elements
*/
public void log(Exception e, Object ... elements);
-
+
/**
* Set the Level to compare logging too
*/
public void setLogLevel(Level level);
-
+
/**
* It is important in some cases to create a class from within the same Classloader that created
* Security Objects. Specifically, it's pretty typical for Web Containers to separate classloaders
- * so as to allow Apps with different dependencies.
+ * so as to allow Apps with different dependencies.
* @return
*/
public ClassLoader classLoader();
@@ -127,7 +127,7 @@ public interface Access {
public void load(InputStream is) throws IOException;
/**
- * if "anytext" is true, then decryption will always be attempted. Otherwise, only if starts with
+ * if "anytext" is true, then decryption will always be attempted. Otherwise, only if starts with
* Symm.ENC
* @param encrypted
* @param anytext
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/BasicCred.java b/cadi/core/src/main/java/org/onap/aaf/cadi/BasicCred.java
index ebb41aba..bdbef713 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/BasicCred.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/BasicCred.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@ package org.onap.aaf.cadi;
* An Interface for testing on Requests to see if we can get a User and Password
* It works for CadiWrap, but also, Container Specific Wraps (aka Tomcat) should also
* implement.
- *
+ *
* @author Jonathan
*
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/BufferedServletInputStream.java b/cadi/core/src/main/java/org/onap/aaf/cadi/BufferedServletInputStream.java
index 8202183d..b6aabf32 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/BufferedServletInputStream.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/BufferedServletInputStream.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,21 +28,21 @@ import javax.servlet.ServletInputStream;
/**
* BufferedServletInputStream
- *
+ *
* There are cases in brain-dead middleware (SOAP) where they store routing information in the content.
- *
+ *
* In HTTP, this requires reading the content from the InputStream which, of course, cannot be re-read.
- *
- * BufferedInputStream exists to implement the "Mark" protocols for Streaming, which will enable being
+ *
+ * BufferedInputStream exists to implement the "Mark" protocols for Streaming, which will enable being
* re-read. Unfortunately, J2EE chose to require a "ServletInputStream" as an abstract class, rather than
- * an interface, which requires we create a delegating pattern, rather than the preferred inheriting pattern.
- *
+ * an interface, which requires we create a delegating pattern, rather than the preferred inheriting pattern.
+ *
* Unfortunately, the standard "BufferedInputStream" cannot be used, because it simply creates a byte array
- * in the "mark(int)" method of that size. This is not appropriate for this application, because the Header
- * can be potentially huge, and if a buffer was allocated to accommodate all possibilities, the cost of memory
+ * in the "mark(int)" method of that size. This is not appropriate for this application, because the Header
+ * can be potentially huge, and if a buffer was allocated to accommodate all possibilities, the cost of memory
* allocation would be too large for high performance transactions.
*
- *
+ *
* @author Jonathan
*
*/
@@ -50,7 +50,7 @@ public class BufferedServletInputStream extends ServletInputStream {
private static final int NONE = 0;
private static final int STORE = 1;
private static final int READ = 2;
-
+
private InputStream is;
private int state = NONE;
private Capacitor capacitor;
@@ -81,7 +81,7 @@ public class BufferedServletInputStream extends ServletInputStream {
value = is.read();
}
}
- }
+ }
return value;
}
@@ -113,7 +113,7 @@ public class BufferedServletInputStream extends ServletInputStream {
if (temp>0) { // watch for -1
count+=temp;
} else if (count<=0) {
- count = temp; // must account for Stream coming back -1
+ count = temp; // must account for Stream coming back -1
}
}
break;
@@ -134,9 +134,9 @@ public class BufferedServletInputStream extends ServletInputStream {
public int available() throws IOException {
int count = is.available();
if (capacitor!=null)count+=capacitor.available();
- return count;
+ return count;
}
-
+
/**
* Return just amount buffered (for debugging purposes, mostly)
* @return
@@ -156,7 +156,7 @@ public class BufferedServletInputStream extends ServletInputStream {
/**
- * Note: Readlimit is ignored in this implementation, because the need was for unknown buffer size which wouldn't
+ * Note: Readlimit is ignored in this implementation, because the need was for unknown buffer size which wouldn't
* require allocating and dumping huge chunks of memory every use, or risk overflow.
*/
public synchronized void mark(int readlimit) {
@@ -174,10 +174,10 @@ public class BufferedServletInputStream extends ServletInputStream {
/**
* Reset Stream
- *
+ *
* Calling this twice is not supported in typical Stream situations, but it is allowed in this service. The caveat is that it can only reset
* the data read in since Mark has been called. The data integrity is only valid if you have not continued to read past what is stored.
- *
+ *
*/
public synchronized void reset() throws IOException {
switch(state) {
@@ -188,7 +188,7 @@ public class BufferedServletInputStream extends ServletInputStream {
case READ:
capacitor.reset();
break;
- case NONE:
+ case NONE:
throw new IOException("InputStream has not been marked");
}
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CachedPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CachedPrincipal.java
index 6f3fe126..68fa1f63 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CachedPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CachedPrincipal.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,20 +25,20 @@ import java.security.Principal;
/**
* Cached Principals need to be able to revalidate in the background.
- *
+ *
* @author Jonathan
*
*/
public interface CachedPrincipal extends Principal {
public enum Resp {NOT_MINE,UNVALIDATED,REVALIDATED,INACCESSIBLE,DENIED};
-
+
/**
* Re-validate with Creator
- *
+ *
* @return
*/
public abstract Resp revalidate(Object state);
-
+
/**
* Store when last updated.
* @return
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CachingLur.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CachingLur.java
index c790f39e..6f4d8d8a 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CachingLur.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CachingLur.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CadiException.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CadiException.java
index 96a55f93..89d42b25 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CadiException.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CadiException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,7 +27,7 @@ package org.onap.aaf.cadi;
*/
public class CadiException extends Exception {
/**
- * Generated ID
+ * Generated ID
*/
private static final long serialVersionUID = -4180145363107742619L;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CadiWrap.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CadiWrap.java
index 34d11623..102782a4 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CadiWrap.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CadiWrap.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,23 +41,23 @@ import org.onap.aaf.cadi.util.Timing;
/**
* Inherit the HttpServletRequestWrapper, which calls methods of delegate it's created with, but
* overload the key security mechanisms with CADI mechanisms
- *
+ *
* This works with mechanisms working strictly with HttpServletRequest (i.e. Servlet Filters)
- *
+ *
* Specialty cases, i.e. Tomcat, which for their containers utilize their own mechanisms and Wrappers, you may
* need something similar. See AppServer specific code (i.e. tomcat) for these.
- *
+ *
* @author Jonathan
*
*/
public class CadiWrap extends HttpServletRequestWrapper implements HttpServletRequest, BasicCred {
private TaggedPrincipal principal;
private Lur lur;
- private String user; // used to set user/pass from brain-dead protocols like WSSE
+ private String user; // used to set user/pass from brain-dead protocols like WSSE
private byte[] password;
private PermConverter pconv;
- private Access access;
-
+ private Access access;
+
/**
* Standard Wrapper constructor for Delegate pattern
* @param request
@@ -93,35 +93,35 @@ public class CadiWrap extends HttpServletRequestWrapper implements HttpServletRe
}
/**
- * Part of the HTTP Security API. Return the User Principal associated with this HTTP
+ * Part of the HTTP Security API. Return the User Principal associated with this HTTP
* Transaction.
*/
@Override
public Principal getUserPrincipal() {
return principal;
}
-
+
/**
* This is the key API call for AUTHZ in J2EE. Given a Role (String passed in), is the user
* associated with this HTTP Transaction allowed to function in this Role?
- *
+ *
* For CADI, we pass the responsibility for determining this to the "LUR", which may be
* determined by the Enterprise.
- *
+ *
* Note: Role check is also done in "CadiRealm" in certain cases...
- *
+ *
*
*/
@Override
public boolean isUserInRole(String perm) {
return perm==null?false:checkPerm(access,"isUserInRole",principal,pconv,lur,perm);
}
-
+
public static boolean checkPerm(Access access, String caller, Principal principal, PermConverter pconv, Lur lur, String perm) {
if (principal== null) {
access.log(Level.AUDIT,caller, "No Principal in Transaction");
return false;
- } else {
+ } else {
final long start = System.nanoTime();
perm = pconv.convert(perm);
if (lur.fish(principal,lur.createPerm(perm))) {
@@ -135,10 +135,10 @@ public class CadiWrap extends HttpServletRequestWrapper implements HttpServletRe
}
- /**
+ /**
* CADI Function (Non J2EE standard). GetPermissions will read the Permissions from AAF (if configured) and Roles from Local Lur, etc
* as implemented with lur.fishAll
- *
+ *
* To utilize, the Request must be a "CadiWrap" object, then call.
*/
public List<Permission> getPermissions(Principal p) {
@@ -148,7 +148,7 @@ public class CadiWrap extends HttpServletRequestWrapper implements HttpServletRe
}
/**
* Allow setting of tafResp and lur after construction
- *
+ *
* This can happen if the CadiWrap is constructed in a Valve other than CadiValve
*/
public void set(TafResp tafResp, Lur lur) {
@@ -175,12 +175,12 @@ public class CadiWrap extends HttpServletRequestWrapper implements HttpServletRe
public void setCred(byte[] passwd) {
password = passwd;
}
-
+
public CadiWrap setPermConverter(PermConverter pc) {
pconv = pc;
return this;
}
-
+
// Add a feature
public void invalidate(String id) {
if (lur instanceof EpiLur) {
@@ -189,11 +189,11 @@ public class CadiWrap extends HttpServletRequestWrapper implements HttpServletRe
((CachingLur<?>)lur).remove(id);
}
}
-
+
public Lur getLur() {
return lur;
}
-
+
public Access access() {
return access;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Capacitor.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Capacitor.java
index f3a2a7fa..57ee115d 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Capacitor.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Capacitor.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,10 +26,10 @@ import java.util.ArrayList;
/**
* Capacitor
- *
+ *
* Storage mechanism for read data, specifically designed for InputStreams.
- *
- * The Standard BufferedInputStream requires a limit to be set for buffered reading, which is
+ *
+ * The Standard BufferedInputStream requires a limit to be set for buffered reading, which is
* impractical for reading SOAP headers, which can be quite large.
* @author Jonathan
*
@@ -39,22 +39,22 @@ public class Capacitor {
private ArrayList<ByteBuffer> bbs = new ArrayList<>();
private ByteBuffer curr = null;
private int idx;
-
+
// Maintain a private RingBuffer for Memory, for efficiency
private static ByteBuffer[] ring = new ByteBuffer[16];
private static int start, end;
-
-
+
+
public void put(byte b) {
if (curr == null || curr.remaining()==0) { // ensure we have a "curr" buffer ready for data
curr = ringGet();
bbs.add(curr);
}
- curr.put(b);
+ curr.put(b);
}
public int read() {
- if (curr!=null) {
+ if (curr!=null) {
if (curr.remaining()>0) { // have a buffer, use it!
return curr.get();
} else if (idx<bbs.size()){ // Buffer not enough, get next one from array
@@ -64,10 +64,10 @@ public class Capacitor {
} // if no curr buffer, treat as end of stream
return -1;
}
-
+
/**
* read into an array like Streams
- *
+ *
* @param array
* @param offset
* @param length
@@ -99,7 +99,7 @@ public class Capacitor {
/**
* Put an array of data into Capacitor
- *
+ *
* @param array
* @param offset
* @param length
@@ -109,7 +109,7 @@ public class Capacitor {
curr = ringGet();
bbs.add(curr);
}
-
+
int len;
while (length>0) {
if ((len=curr.remaining())>length) {
@@ -125,7 +125,7 @@ public class Capacitor {
}
}
}
-
+
/**
* Move state from Storage mode into Read mode, changing all internal buffers to read mode, etc
*/
@@ -141,7 +141,7 @@ public class Capacitor {
idx=1;
}
}
-
+
/**
* reuse all the buffers
*/
@@ -152,10 +152,10 @@ public class Capacitor {
bbs.clear();
curr = null;
}
-
+
/**
* Declare amount of data available to be read at once.
- *
+ *
* @return
*/
public int available() {
@@ -165,7 +165,7 @@ public class Capacitor {
}
return count;
}
-
+
/**
* Returns how many are left that were not skipped
* @param n
@@ -184,7 +184,7 @@ public class Capacitor {
n=0;
} else {
curr.position(curr.limit());
-
+
skipped-=skip;
if (idx<bbs.size()) {
curr=bbs.get(idx++);
@@ -214,7 +214,7 @@ public class Capacitor {
}
/*
- * Ring Functions. Reuse allocated memory
+ * Ring Functions. Reuse allocated memory
*/
private ByteBuffer ringGet() {
ByteBuffer bb = null;
@@ -230,7 +230,7 @@ public class Capacitor {
}
return bb;
}
-
+
private void ringPut(ByteBuffer bb) {
synchronized(ring) {
ring[end]=bb; // if null or not, BB will just be Garbage collected
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java
index b697f373..53c35fc5 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@ import org.onap.aaf.cadi.util.JsonOutputStream;
/**
* A Class to run on command line to determine suitability of environment for certain TAFs.
- * *
+ * *
* @author Jonathan
*
*/
@@ -90,7 +90,7 @@ public class CmdLine {
System.out.println(args[1]);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
b64.enpass(args[1], baos);
- String pass;
+ String pass;
System.out.println(pass=new String(baos.toByteArray()));
ByteArrayOutputStream reconstituted = new ByteArrayOutputStream();
b64.depass(pass, reconstituted);
@@ -104,13 +104,13 @@ public class CmdLine {
}
System.out.flush();
*/
-
+
} catch (IOException e) {
System.err.println("Cannot digest password");
System.err.println(" \""+ e.getMessage() + '"');
}
// DO NOT LEAVE THIS METHOD Compiled IN CODE... Do not want looking at passwords on disk too easy
-// Jonathan. Oh, well, Deployment services need this behavior. I will put this code in, but leave it undocumented.
+// Jonathan. Oh, well, Deployment services need this behavior. I will put this code in, but leave it undocumented.
// One still needs access to the keyfile to read.
// July 2016 - thought of a tool "CMPass" to regurgitate from properties, but only if allowed.
} else if (("regurgitate".equalsIgnoreCase(args[0]) || "undigest".equalsIgnoreCase(args[0]))
@@ -151,7 +151,7 @@ public class CmdLine {
}
} else {
int idx;
- if ((idx = line.indexOf(' '))>=0
+ if ((idx = line.indexOf(' '))>=0
&& (idx = line.indexOf(' ',++idx))>0
&& (idx = line.indexOf('=',++idx))>0
) {
@@ -249,7 +249,7 @@ public class CmdLine {
int salt = Integer.parseInt(args[i]);
System.out.println(Hash.hashSHA256asStringHex(args[1],salt));
}
- } else {
+ } else {
System.out.println(Hash.hashSHA256asStringHex(args[1]));
}
} catch (NoSuchAlgorithmException e) {
@@ -280,13 +280,13 @@ public class CmdLine {
System.err.println("Cannot create a key " + args[0]);
System.err.println(" \""+ e.getMessage() + '"');
}
-
+
} else if ("passgen".equalsIgnoreCase(args[0])) {
int numDigits;
if (args.length <= 1) {
numDigits = 24;
} else {
- numDigits = Integer.parseInt(args[1]);
+ numDigits = Integer.parseInt(args[1]);
if (numDigits<8)numDigits = 8;
}
String pass;
@@ -305,17 +305,17 @@ public class CmdLine {
}
if (noLower) {
noLower=!(c>=0x61 && c<=0x7A);
- }
+ }
if (noUpper) {
noUpper=!(c>=0x41 && c<=0x5A);
- }
+ }
if (noDigits) {
noDigits=!(c>=0x30 && c<=0x39);
- }
+ }
if (noSpecial) {
noSpecial = "+!@#$%^&*(){}[]?:;,.".indexOf(c)<0;
- }
-
+ }
+
missingChars = (noLower || noUpper || noDigits || noSpecial);
}
} while (missingChars || repeatingChars);
@@ -325,7 +325,7 @@ public class CmdLine {
if (args.length <= 1) {
numDigits = 24;
} else {
- numDigits = Integer.parseInt(args[1]);
+ numDigits = Integer.parseInt(args[1]);
}
System.out.println(Symm.randomGen(Symm.base64url.codeset, numDigits).substring(0,numDigits));
}
@@ -349,9 +349,9 @@ public class CmdLine {
System.exit(1);
}
}
-
+
public static void setSystemExit(boolean shouldExit) {
systemExit = shouldExit;
}
-
+
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Connector.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Connector.java
index f88c3fbe..88ac57e6 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Connector.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Connector.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CredVal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CredVal.java
index 6019f551..dcb30088 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CredVal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CredVal.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,16 +24,16 @@ package org.onap.aaf.cadi;
/**
* UserPass
- *
- * The essential interface required by BasicAuth to determine if a given User/Password combination is
+ *
+ * The essential interface required by BasicAuth to determine if a given User/Password combination is
* valid. This is done as an interface.
- *
+ *
* @author Jonathan
*/
public interface CredVal {
public enum Type{PASSWORD};
/**
- * Validate if the User/Password combination matches records
+ * Validate if the User/Password combination matches records
* @param user
* @param pass
* @return
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CredValDomain.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CredValDomain.java
index db5ab0f2..4a8015a3 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CredValDomain.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CredValDomain.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/GetCred.java b/cadi/core/src/main/java/org/onap/aaf/cadi/GetCred.java
index 039ba8f7..4c5ca543 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/GetCred.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/GetCred.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Hash.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Hash.java
index 3027fd74..26c33c84 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Hash.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Hash.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,7 +27,7 @@ import java.security.NoSuchAlgorithmException;
public class Hash {
private static char hexDigit[] = "0123456789abcdef".toCharArray();
-
+
/////////////////////////////////
// MD5
/////////////////////////////////
@@ -38,9 +38,9 @@ public class Hash {
* @throws NoSuchAlgorithmException
*/
public static byte[] hashMD5 (byte[] input) throws NoSuchAlgorithmException {
- // Note: Protect against Multi-thread issues with new MessageDigest
+ // Note: Protect against Multi-thread issues with new MessageDigest
MessageDigest md = MessageDigest.getInstance("MD5");
- md.update(input);
+ md.update(input);
return md.digest();
}
@@ -51,17 +51,17 @@ public class Hash {
* @throws NoSuchAlgorithmException
*/
public static byte[] hashMD5 (byte[] input, int offset, int length) throws NoSuchAlgorithmException {
- // Note: Protect against Multi-thread issues with new MessageDigest
+ // Note: Protect against Multi-thread issues with new MessageDigest
MessageDigest md = MessageDigest.getInstance("MD5");
- md.update(input,offset,length);
+ md.update(input,offset,length);
return md.digest();
}
/**
- * Convenience Function: Encrypt MD5 from String to String Hex representation
- *
+ * Convenience Function: Encrypt MD5 from String to String Hex representation
+ *
* @param input
* @return
* @throws NoSuchAlgorithmException
@@ -83,9 +83,9 @@ public class Hash {
* SHA256 Hashing
*/
public static byte[] hashSHA256(byte[] input) throws NoSuchAlgorithmException {
- // Note: Protect against Multi-thread issues with new MessageDigest
+ // Note: Protect against Multi-thread issues with new MessageDigest
MessageDigest md = MessageDigest.getInstance("SHA-256");
- md.update(input);
+ md.update(input);
return md.digest();
}
@@ -93,15 +93,15 @@ public class Hash {
* SHA256 Hashing
*/
public static byte[] hashSHA256(byte[] input, int offset, int length) throws NoSuchAlgorithmException {
- // Note: Protect against Multi-thread issues with new MessageDigest
+ // Note: Protect against Multi-thread issues with new MessageDigest
MessageDigest md = MessageDigest.getInstance("SHA-256");
- md.update(input,offset,length);
+ md.update(input,offset,length);
return md.digest();
}
-
+
/**
* Convenience Function: Hash from String to String Hex representation
- *
+ *
* @param input
* @return
* @throws NoSuchAlgorithmException
@@ -112,7 +112,7 @@ public class Hash {
/**
* Convenience Function: Hash from String to String Hex representation
- *
+ *
* @param input
* @return
* @throws NoSuchAlgorithmException
@@ -124,7 +124,7 @@ public class Hash {
bb.put(input.getBytes());
return toHex(Hash.hashSHA256(bb.array()));
}
-
+
/**
* Compare two byte arrays for equivalency
* @param ba1
@@ -166,7 +166,7 @@ public class Hash {
}
return sb.toString();
}
-
+
public static String toHex(byte[] ba, int start, int length) {
StringBuilder sb = new StringBuilder("0x");
for (int i=start;i<length;++i) {
@@ -176,7 +176,7 @@ public class Hash {
return sb.toString();
}
-
+
public static byte[] fromHex(String s) throws CadiException{
if (!s.startsWith("0x")) {
throw new CadiException("HexString must start with \"0x\"");
@@ -212,7 +212,7 @@ public class Hash {
/**
* Does not expect to start with "0x"
* if Any Character doesn't match, it returns null;
- *
+ *
* @param s
* @return
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Locator.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Locator.java
index c40cb998..46e6f7e5 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Locator.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Locator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,7 +30,7 @@ public interface Locator<T> {
public Item next(Item item) throws LocatorException;
public boolean refresh();
public void destroy();
-
+
public interface Item {}
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/LocatorException.java b/cadi/core/src/main/java/org/onap/aaf/cadi/LocatorException.java
index da56d4b2..8eb0e27a 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/LocatorException.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/LocatorException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,7 +23,7 @@ package org.onap.aaf.cadi;
public class LocatorException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = -4267929804321134469L;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Lur.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Lur.java
index bdc9f643..cce91e06 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Lur.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Lur.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,37 +30,37 @@ import java.util.List;
* LUR: Local User Registry
*
* Concept by Robert Garskof, Implementation by Jonathan Gathman
- *
+ *
* Where we can keep local copies of users and roles for faster Authorization when asked.
- *
- * Note: Author cannot resist the mental image of using a Fishing Lure to this LUR pattern
- *
+ *
+ * Note: Author cannot resist the mental image of using a Fishing Lure to this LUR pattern
+ *
* @author Jonathan
*
*/
public interface Lur {
/**
- * Allow the Lur, which has correct Permission access, to create and hand back.
+ * Allow the Lur, which has correct Permission access, to create and hand back.
*/
public Permission createPerm(String p);
-
- /**
+
+ /**
* Fish for Principals in a Pond
- *
+ *
* or more boringly, is the User identified within a named collection representing permission.
- *
+ *
* @param principalName
* @return
*/
public boolean fish(Principal bait, Permission ... pond);
- /**
+ /**
* Fish all the Principals out a Pond
- *
+ *
* For additional humor, pronounce the following with a Southern Drawl, "FishOil"
- *
+ *
* or more boringly, load the List with Permissions found for Principal
- *
+ *
* @param principalName
* @return
*/
@@ -72,19 +72,19 @@ public interface Lur {
public void destroy();
/**
- * Does this LUR handle this pond exclusively? Important for EpiLUR to determine whether
- * to try another (more expensive) LUR
+ * Does this LUR handle this pond exclusively? Important for EpiLUR to determine whether
+ * to try another (more expensive) LUR
* @param pond
* @return
*/
- public boolean handlesExclusively(Permission ... pond);
-
+ public boolean handlesExclusively(Permission ... pond);
+
/**
* Does the LUR support a particular kind of Principal
* This can be used to check name's domain, like above, or Principal type
*/
public boolean handles(Principal principal);
-
+
/**
* Clear: Clear any Caching, if exists
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Permission.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Permission.java
index 2537c386..f45e5e07 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Permission.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Permission.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
index 92756d8c..c4719f86 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
@@ -3,15 +3,15 @@
* org.onap.aaf
* ===========================================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
- *
+ *
* Modifications Copyright (C) 2018 IBM.
* ===========================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -59,7 +59,7 @@ public class PropAccess implements Access {
logIt = new StreamLogIt(System.out);
init(null);
}
-
+
/**
* This Constructor soly exists to instantiate Servlet Context Based Logging that will call "init" later.
* @param sc
@@ -68,29 +68,29 @@ public class PropAccess implements Access {
logIt = new StreamLogIt(System.out);
props = new Properties();
}
-
+
public PropAccess(String ... args) {
this(System.out,args);
}
-
+
public PropAccess(PrintStream ps, String[] args) {
logIt = new StreamLogIt(ps==null?System.out:ps);
init(logIt,args);
}
-
+
public PropAccess(LogIt logit, String[] args) {
init(logit, args);
}
-
+
public PropAccess(Properties p) {
this(System.out,p);
}
-
+
public PropAccess(PrintStream ps, Properties p) {
logIt = new StreamLogIt(ps==null?System.out:ps);
init(p);
}
-
+
protected void init(final LogIt logIt, final String[] args) {
this.logIt = logIt;
Properties nprops=new Properties();
@@ -102,7 +102,7 @@ public class PropAccess implements Access {
}
init(nprops);
}
-
+
public static SimpleDateFormat newISO8601() {
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
}
@@ -110,7 +110,7 @@ public class PropAccess implements Access {
protected synchronized void init(Properties p) {
// Make sure these two are set before any changes in Logging
name = "cadi";
-
+
props = new Properties();
// First, load related System Properties
for (Entry<Object,Object> es : System.getProperties().entrySet()) {
@@ -119,24 +119,24 @@ public class PropAccess implements Access {
if (key.startsWith(start)) {
props.put(key, es.getValue());
}
- }
+ }
}
// Second, overlay or fill in with Passed in Props
if (p!=null) {
props.putAll(p);
}
-
+
// Preset LogLevel
- String sLevel = props.getProperty(Config.CADI_LOGLEVEL);
+ String sLevel = props.getProperty(Config.CADI_LOGLEVEL);
// Third, load any Chained Property Files
load(props.getProperty(Config.CADI_PROP_FILES));
-
+
if(sLevel==null) { // if LogLev wasn't set before, check again after Chained Load
- sLevel = props.getProperty(Config.CADI_LOGLEVEL);
+ sLevel = props.getProperty(Config.CADI_LOGLEVEL);
if (sLevel==null) {
level=DEFAULT.maskOf();
} else {
- level=Level.valueOf(sLevel).maskOf();
+ level=Level.valueOf(sLevel).maskOf();
}
}
// Setup local Symmetrical key encryption
@@ -149,21 +149,21 @@ public class PropAccess implements Access {
System.exit(1);
}
}
-
+
name = props.getProperty(Config.CADI_LOGNAME, name);
-
+
SecurityInfo.setHTTPProtocols(this);
-
+
}
-
-
+
+
private void load(String cadi_prop_files) {
if (cadi_prop_files==null) {
return;
}
String prevKeyFile = props.getProperty(Config.CADI_KEYFILE);
-
+
for(String filename : Split.splitTrim(File.pathSeparatorChar, cadi_prop_files)) {
Properties fileProps = new Properties();
File file = new File(filename);
@@ -208,8 +208,8 @@ public class PropAccess implements Access {
printf(Level.WARN,"Warning: recursive CADI Property %s does not exist",file.getAbsolutePath());
}
}
-
- // Trim
+
+ // Trim
for (Entry<Object, Object> es : props.entrySet()) {
Object value = es.getValue();
if (value instanceof String) {
@@ -237,7 +237,7 @@ public class PropAccess implements Access {
prevKeyFile=newKeyFile;
}
-
+
String loglevel = props.getProperty(Config.CADI_LOGLEVEL);
if (loglevel!=null) {
try {
@@ -247,7 +247,7 @@ public class PropAccess implements Access {
}
}
}
-
+
@Override
public void load(InputStream is) throws IOException {
props.load(is);
@@ -264,7 +264,7 @@ public class PropAccess implements Access {
public StringBuilder buildMsg(Level level, Object[] elements) {
return buildMsg(name,iso8601,level,elements);
}
-
+
/*
* Need to pass in DateFormat per thread, because not marked as thread safe
*/
@@ -286,7 +286,7 @@ public class PropAccess implements Access {
sb.append("] ");
} else {
int idx = 0;
- if(elements[idx]!=null &&
+ if(elements[idx]!=null &&
elements[idx] instanceof Integer) {
sb.append('-');
sb.append(elements[idx]);
@@ -298,7 +298,7 @@ public class PropAccess implements Access {
}
return sb;
}
-
+
private static boolean write(boolean first, StringBuilder sb, Object[] elements) {
String s;
for (Object o : elements) {
@@ -374,7 +374,7 @@ public class PropAccess implements Access {
? symm.depass(encrypted)
: encrypted;
}
-
+
public String encrypt(String unencrypted) throws IOException {
return Symm.ENC+symm.enpass(unencrypted);
}
@@ -385,7 +385,7 @@ public class PropAccess implements Access {
public String getProperty(String tag) {
return props.getProperty(tag);
}
-
+
public Properties getProperties() {
return props;
@@ -410,10 +410,10 @@ public class PropAccess implements Access {
public interface LogIt {
public void push(Level level, Object ... elements) ;
}
-
+
private class StreamLogIt implements LogIt {
private PrintStream ps;
-
+
public StreamLogIt(PrintStream ps) {
this.ps = ps;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Revalidator.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Revalidator.java
index 66ba86ae..33a5bc91 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Revalidator.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Revalidator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@ package org.onap.aaf.cadi;
public interface Revalidator<TRANS> {
/**
* Re-Validate Credential
- *
+ *
* @param prin
* @return
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/SecuritySetter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/SecuritySetter.java
index 194712e0..7e263831 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/SecuritySetter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/SecuritySetter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,17 +24,17 @@ package org.onap.aaf.cadi;
/**
* Apply any particular security mechanism
- *
- * This allows the definition of various mechanisms involved outside of DRcli jars
- *
+ *
+ * This allows the definition of various mechanisms involved outside of DRcli jars
+ *
* @author Jonathan
*
*/
public interface SecuritySetter<CT> {
public String getID();
-
+
public void setSecurity(CT client) throws CadiException;
-
+
/**
* Returns number of bad logins registered
* @param respCode
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/ServletContextAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/ServletContextAccess.java
index 998b87c9..be6e5329 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/ServletContextAccess.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/ServletContextAccess.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java
index e7533610..b1ec4caf 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,37 +43,37 @@ import org.onap.aaf.cadi.config.Config;
/**
* Key Conversion, primarily "Base64"
- *
+ *
* Base64 is required for "Basic Authorization", which is an important part of the overall CADI Package.
- *
- * Note: This author found that there is not a "standard" library for Base64 conversion within Java.
- * The source code implementations available elsewhere were surprisingly inefficient, requiring, for
+ *
+ * Note: This author found that there is not a "standard" library for Base64 conversion within Java.
+ * The source code implementations available elsewhere were surprisingly inefficient, requiring, for
* instance, multiple string creation, on a transaction pass. Integrating other packages that might be
- * efficient enough would put undue Jar File Dependencies given this Framework should have none-but-Java
+ * efficient enough would put undue Jar File Dependencies given this Framework should have none-but-Java
* dependencies.
- *
+ *
* The essential algorithm is good for a symmetrical key system, as Base64 is really just
- * a symmetrical key that everyone knows the values.
- *
- * This code is quite fast, taking about .016 ms for encrypting, decrypting and even .08 for key
- * generation. The speed quality, especially of key generation makes this a candidate for a short term token
+ * a symmetrical key that everyone knows the values.
+ *
+ * This code is quite fast, taking about .016 ms for encrypting, decrypting and even .08 for key
+ * generation. The speed quality, especially of key generation makes this a candidate for a short term token
* used for identity.
- *
- * It may be used to easily avoid placing Clear-Text passwords in configurations, etc. and contains
- * supporting functions such as 2048 keyfile generation (see keygen). This keyfile should, of course,
- * be set to "400" (Unix) and protected as any other mechanism requires.
- *
+ *
+ * It may be used to easily avoid placing Clear-Text passwords in configurations, etc. and contains
+ * supporting functions such as 2048 keyfile generation (see keygen). This keyfile should, of course,
+ * be set to "400" (Unix) and protected as any other mechanism requires.
+ *
* AES Encryption is also employed to include standards.
- *
+ *
* @author Jonathan
*
*/
public class Symm {
- private static final byte[] DOUBLE_EQ = new byte[] {'=','='};
+ private static final byte[] DOUBLE_EQ = new byte[] {'=','='};
public static final String ENC = "enc:";
private static final Object LOCK = new Object();
private static final SecureRandom random = new SecureRandom();
-
+
public final char[] codeset;
private final int splitLinesAt;
private final String encoding;
@@ -83,7 +83,7 @@ public class Symm {
//Note: AES Encryption is not Thread Safe. It is Synchronized
//private AES aes = null; // only initialized from File, and only if needed for Passwords
private String name;
-
+
/**
* This is the standard base64 Key Set.
* RFC 2045
@@ -116,15 +116,15 @@ public class Symm {
* Note, this is too large to fit into the algorithm. Only use with PassGen
*/
private static char passChars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+!@#$%^&*(){}[]?:;,.".toCharArray();
-
+
private static Symm internalOnly = null;
-
+
/**
* Use this to create special case Case Sets and/or Line breaks
- *
+ *
* If you don't know why you need this, use the Singleton Method
- *
+ *
* @param codeset
* @param split
*/
@@ -136,8 +136,8 @@ public class Symm {
this.name = name;
char prev = 0, curr=0, first = 0;
int offset=Integer.SIZE; // something that's out of range for integer array
-
- // There can be time efficiencies gained when the underlying keyset consists mainly of ordered
+
+ // There can be time efficiencies gained when the underlying keyset consists mainly of ordered
// data (i.e. abcde...). Therefore, we'll quickly analyze the keyset. If it proves to have
// too much entropy, the "Unordered" algorithm, which is faster in such cases is used.
ArrayList<int[]> la = new ArrayList<>();
@@ -146,7 +146,7 @@ public class Symm {
if (prev+1==curr) { // is next character in set
prev = curr;
} else {
- if (offset!=Integer.SIZE) { // add previous range
+ if (offset!=Integer.SIZE) { // add previous range
la.add(new int[]{first,prev,offset});
}
first = prev = curr;
@@ -162,11 +162,11 @@ public class Symm {
convert = new Ordered(range);
}
}
-
+
public Symm copy(int lines) {
return new Symm(codeset,lines,encoding,endEquals, "Copied " + lines);
}
-
+
// Only used by keygen, which is intentionally randomized. Therefore, always use unordered
private Symm(char[] codeset, Symm parent) {
this.codeset = codeset;
@@ -186,7 +186,7 @@ public class Symm {
}
/**
- * Obtain the base64() behavior of this class, for use in standard BASIC AUTH mechanism, etc.
+ * Obtain the base64() behavior of this class, for use in standard BASIC AUTH mechanism, etc.
* No Line Splitting
* @return
*/
@@ -222,7 +222,7 @@ public class Symm {
}
return exec.exec(new AES(keyBytes,0,keyBytes.length));
}
-
+
public interface Encryption {
public CipherOutputStream outputStream(OutputStream os, boolean encrypt);
public CipherInputStream inputStream(InputStream is, boolean encrypt);
@@ -231,7 +231,7 @@ public class Symm {
public static interface SyncExec<T> {
public T exec(Encryption enc) throws IOException, Exception;
}
-
+
public byte[] encode(byte[] toEncrypt) throws IOException {
if (toEncrypt==null) {
return EMPTY;
@@ -251,7 +251,7 @@ public class Symm {
/**
* Helper function for String API of "Encode"
* use "getBytes" with appropriate char encoding, etc.
- *
+ *
* @param str
* @return
* @throws IOException
@@ -259,7 +259,7 @@ public class Symm {
public String encode(String str) throws IOException {
byte[] array;
boolean useDefaultEncoding = false;
- try {
+ try {
array = str.getBytes(encoding);
} catch (IOException e) {
array = str.getBytes(); // take default
@@ -267,14 +267,14 @@ public class Symm {
}
// Calculate expected size to avoid any buffer expansion copies within the ByteArrayOutput code
ByteArrayOutputStream baos = new ByteArrayOutputStream((int)(array.length*1.363)); // account for 4 bytes for 3 and a byte or two more
-
+
encode(new ByteArrayInputStream(array),baos);
if (useDefaultEncoding) {
return baos.toString();
}
return baos.toString(encoding);
}
-
+
/**
* Helper function for the String API of "Decode"
* use "getBytes" with appropriate char encoding, etc.
@@ -285,7 +285,7 @@ public class Symm {
public String decode(String str) throws IOException {
byte[] array;
boolean useDefaultEncoding = false;
- try {
+ try {
array = str.getBytes(encoding);
} catch (IOException e) {
array = str.getBytes(); // take default
@@ -302,9 +302,9 @@ public class Symm {
/**
* Convenience Function
- *
+ *
* encode String into InputStream and call encode(InputStream, OutputStream)
- *
+ *
* @param string
* @param out
* @throws IOException
@@ -315,9 +315,9 @@ public class Symm {
/**
* Convenience Function
- *
+ *
* encode String into InputStream and call decode(InputStream, OutputStream)
- *
+ *
* @param string
* @param out
* @throws IOException
@@ -331,16 +331,16 @@ public class Symm {
encode(is,os);
}
- /**
+ /**
* encode InputStream onto Output Stream
- *
+ *
* @param is
* @param estimate
* @return
* @throws IOException
*/
public void encode(InputStream is, OutputStream os) throws IOException {
- // StringBuilder sb = new StringBuilder((int)(estimate*1.255)); // try to get the right size of StringBuilder from start.. slightly more than 1.25 times
+ // StringBuilder sb = new StringBuilder((int)(estimate*1.255)); // try to get the right size of StringBuilder from start.. slightly more than 1.25 times
int prev=0;
int read, idx=0, line=0;
boolean go;
@@ -360,7 +360,7 @@ public class Symm {
os.write(codeset[((prev & 0x03)<<4) | (read>>4)]);
prev = read;
break;
- default: //(3+)
+ default: //(3+)
// Char 1 is last 4 bits of prev plus the first 2 bits of read
// Char 2 is the last 6 bits of read
os.write(codeset[(((prev & 0xF)<<2) | (read>>6))]);
@@ -387,7 +387,7 @@ public class Symm {
}
idx = 0;
}
-
+
} while (go);
}
@@ -412,7 +412,7 @@ public class Symm {
if (index>=0) {
switch(++idx) { // 1 based cases, slightly faster ++
case 1: // index goes into first 6 bits of prev
- prev = index<<2;
+ prev = index<<2;
break;
case 2: // write second 2 bits of into prev, write byte, last 4 bits go into prev
os.write((byte)(prev|(index>>4)));
@@ -430,7 +430,7 @@ public class Symm {
};
os.flush();
}
-
+
/**
* Interface to allow this class to choose which algorithm to find index of character in Key
* @author Jonathan
@@ -454,7 +454,7 @@ public class Symm {
public int convert(int read) throws IOException {
// System.out.print((char)read);
switch(read) {
- case -1:
+ case -1:
case '=':
case ' ':
case '\n':
@@ -469,7 +469,7 @@ public class Symm {
throw new IOException("Unacceptable Character in Stream");
}
}
-
+
/**
* Unordered, i.e. the key is purposely randomized, simply has to investigate each character
* until we find a match.
@@ -483,7 +483,7 @@ public class Symm {
}
public int convert(int read) throws IOException {
switch(read) {
- case -1:
+ case -1:
case '=':
case '\n':
case '\r':
@@ -499,7 +499,7 @@ public class Symm {
/**
* Generate a 2048 based Key from which we extract our code base
- *
+ *
* @return
* @throws IOException
*/
@@ -510,7 +510,7 @@ public class Symm {
base64url.encode(new ByteArrayInputStream(inkey), baos);
return baos.toByteArray();
}
-
+
// A class allowing us to be less predictable about significant digits (i.e. not picking them up from the
// beginning, and not picking them up in an ordered row. Gives a nice 2048 with no visible patterns.
private class Obtain {
@@ -518,7 +518,7 @@ public class Symm {
private int skip;
private int length;
private byte[] key;
-
+
private Obtain(Symm b64, byte[] key) {
skip = Math.abs(key[key.length-13]%key.length);
if ((key.length&0x1) == (skip&0x1)) { // if both are odd or both are even
@@ -528,19 +528,19 @@ public class Symm {
last = 17+length%59; // never start at beginning
this.key = key;
}
-
+
private int next() {
return Math.abs(key[(++last*skip)%key.length])%length;
}
};
-
+
/**
* Obtain a Symm from "keyfile" (Config.KEYFILE) property
- *
+ *
* @param acesss
* @return
- * @throws IOException
- * @throws CadiException
+ * @throws IOException
+ * @throws CadiException
*/
public static Symm obtain(Access access) throws CadiException {
String keyfile = access.getProperty(Config.CADI_KEYFILE,null);
@@ -586,7 +586,7 @@ public class Symm {
}
}
/**
- * Create a new random key
+ * Create a new random key
*/
public Symm obtain() throws IOException {
byte inkey[] = new byte[0x800];
@@ -595,10 +595,10 @@ public class Symm {
s.name = "from Random";
return s;
}
-
+
/**
* Obtain a Symm from 2048 key from a String
- *
+ *
* @param key
* @return
* @throws IOException
@@ -608,10 +608,10 @@ public class Symm {
s.name = "from String";
return s;
}
-
+
/**
* Obtain a Symm from 2048 key from a Stream
- *
+ *
* @param is
* @return
* @throws IOException
@@ -635,7 +635,7 @@ public class Symm {
/**
* Convenience for picking up Keyfile
- *
+ *
* @param f
* @return
* @throws IOException
@@ -654,7 +654,7 @@ public class Symm {
* Decrypt into a String
*
* Convenience method
- *
+ *
* @param password
* @return
* @throws IOException
@@ -667,7 +667,7 @@ public class Symm {
/**
* Create an encrypted password, making sure that even short passwords have a minimum length.
- *
+ *
* @param password
* @param os
* @throws IOException
@@ -682,7 +682,7 @@ public class Symm {
if (this.getClass().getSimpleName().startsWith("base64")) { // don't expose randomization
dos.write(bytes);
} else {
-
+
Random r = new SecureRandom();
int start = 0;
byte b;
@@ -710,7 +710,7 @@ public class Symm {
dos.write(bytes);
}
}
-
+
// 7/21/2016 Jonathan add AES Encryption to the mix
try {
exec(new SyncExec<Void>() {
@@ -735,9 +735,9 @@ public class Symm {
/**
* Decrypt a password into a String
- *
+ *
* Convenience method
- *
+ *
* @param password
* @return
* @throws IOException
@@ -748,12 +748,12 @@ public class Symm {
depass(password,baos);
return new String(baos.toByteArray());
}
-
+
/**
* Decrypt a password
- *
+ *
* Skip Symm.ENC
- *
+ *
* @param password
* @param os
* @return
@@ -803,7 +803,7 @@ public class Symm {
dos.writeByte(dis.readByte());
}
} else {
- int pre =((Byte.SIZE*3+Integer.SIZE+Byte.SIZE)/Byte.SIZE)+start;
+ int pre =((Byte.SIZE*3+Integer.SIZE+Byte.SIZE)/Byte.SIZE)+start;
os.write(bytes, pre, bytes.length-pre);
}
}
@@ -811,9 +811,9 @@ public class Symm {
}
public static String randomGen(int numBytes) {
- return randomGen(passChars,numBytes);
+ return randomGen(passChars,numBytes);
}
-
+
public static String randomGen(char[] chars ,int numBytes) {
int rint;
StringBuilder sb = new StringBuilder(numBytes);
@@ -824,11 +824,11 @@ public class Symm {
return sb.toString();
}
// Internal mechanism for helping to randomize placement of characters within a Symm codeset
- // Based on an incoming data stream (originally created randomly, but can be recreated within
+ // Based on an incoming data stream (originally created randomly, but can be recreated within
// 2048 key), go after a particular place in the new codeset. If that codeset spot is used, then move
- // right or left (depending on iteration) to find the next available slot. In this way, key generation
+ // right or left (depending on iteration) to find the next available slot. In this way, key generation
// is speeded up by only enacting N iterations, but adds a spreading effect of the random number stream, so that keyset is also
- // shuffled for a good spread. It is, however, repeatable, given the same number set, allowing for
+ // shuffled for a good spread. It is, however, repeatable, given the same number set, allowing for
// quick recreation when the official stream is actually obtained.
public Symm obtain(byte[] key) throws IOException {
int filled = codeset.length;
@@ -844,7 +844,7 @@ public class Symm {
if (index<0 || index>=codeset.length) {
System.out.println("uh, oh");
}
- if (right) { // alternate going left or right to find the next open slot (keeps it from taking too long to hit something)
+ if (right) { // alternate going left or right to find the next open slot (keeps it from taking too long to hit something)
for (int j=index;j<end;++j) {
if (seq[j]==0) {
seq[j]=codeset[filled];
@@ -879,12 +879,12 @@ public class Symm {
return newSymm;
}
-
- /**
+
+ /**
* This Symm is generated for internal JVM use. It has no external keyfile, but can be used
* for securing Memory, as it remains the same ONLY of the current JVM
* @return
- * @throws IOException
+ * @throws IOException
*/
public static synchronized Symm internalOnly() throws IOException {
if (internalOnly==null) {
@@ -897,7 +897,7 @@ public class Symm {
}
return internalOnly;
}
-
+
@Override
public String toString() {
return name;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Taf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Taf.java
index 771ebcf4..ee9b343a 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Taf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Taf.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,33 +25,33 @@ import org.onap.aaf.cadi.taf.TafResp;
/**
- * TAF - Transmutative Assertion Framework.
- *
+ * TAF - Transmutative Assertion Framework.
+ *
* This main Interface embodies the essential of the assertion, where a number of different TAFs might be used to authenticate
* and that authentication to be recognized through other elements.
- *
+ *
* Concept by Robert Garskof. Implemented by Jonathan Gathman
- *
+ *
* @author Jonathan
*
*/
public interface Taf {
enum LifeForm {CBLF, SBLF, LFN};
/**
- * The lifeForm param is a humorous way of describing whether the interaction is proceeding from direct Human Interaction via a browser
+ * The lifeForm param is a humorous way of describing whether the interaction is proceeding from direct Human Interaction via a browser
* or App which can directly query a memorized password, key sequence, bio-feedback, from that user, or a machine mechanism for which identity
- * can more easily be determined by Certificate, Mechanical ID/Password etc. Popularized in modern culture and Science Fiction (especially
- * Star Trek), we (starting with Robert Garskof) use the terms "Carbon Based Life Form" (CBLF) for mechanisms with people at the end of them, or
+ * can more easily be determined by Certificate, Mechanical ID/Password etc. Popularized in modern culture and Science Fiction (especially
+ * Star Trek), we (starting with Robert Garskof) use the terms "Carbon Based Life Form" (CBLF) for mechanisms with people at the end of them, or
* "Silicon Based Life Forms" (SBLF) to indicate machine only interactions. I have added "LFN" for (Life-Form Neutral) to aid identifying
- * processes for which it doesn't matter whether there is a human at the immediate end of the chain, or cannot be determined mechanically.
- *
+ * processes for which it doesn't matter whether there is a human at the immediate end of the chain, or cannot be determined mechanically.
+ *
* The variable parameter is not necessarily ideal, but with too many unknown Tafs to be created, flexibility,
* is unfortunately required at this point. Future versions could lock this down more. Jonathan 10/18/2012
- *
+ *
* @param lifeForm
* @param info
* @return
*/
public TafResp validate(LifeForm reading, String ... info);
-
+
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Transmutate.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Transmutate.java
index 1203b8d2..b88591fa 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Transmutate.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Transmutate.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,18 +26,18 @@ import java.security.Principal;
/**
* The unique element of TAF is that we establish the relationship/mechanism to mutate the Principal derived from
* one Authentication mechanism into a trustable Principal of another. The mechanism needs to be decided by system
- * trusting.
- *
+ * trusting.
+ *
* The Generic "T" is used so that the code used will be very specific for the implementation, enforced by Compiler
- *
- * This interface will allow differences of trusting Transmutation of Authentication
+ *
+ * This interface will allow differences of trusting Transmutation of Authentication
* @author Jonathan
*
*/
public interface Transmutate<T> {
/**
* Mutate the (assumed validated) Principal into the expected Principal name to be used to construct
- *
+ *
* @param p
* @return
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/TrustChecker.java b/cadi/core/src/main/java/org/onap/aaf/cadi/TrustChecker.java
index 6b1433f4..3ab9c290 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/TrustChecker.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/TrustChecker.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,13 +27,13 @@ import org.onap.aaf.cadi.taf.TafResp;
/**
* Change to another Principal based on Trust of caller and User Chain (if desired)
- *
+ *
* @author Jonathan
*
*/
public interface TrustChecker {
public TafResp mayTrust(TafResp tresp, HttpServletRequest req);
-
+
/**
* A class that trusts no-one else, so just return same TResp
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/User.java b/cadi/core/src/main/java/org/onap/aaf/cadi/User.java
index cb3b4e8f..97837555 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/User.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/User.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@ import org.onap.aaf.cadi.lur.LocalPermission;
/**
* Class to hold info from the User Perspective.
- *
+ *
* @author Jonathan
*
*/
@@ -44,7 +44,7 @@ public final class User<PERM extends Permission> {
long permExpires;
private final long interval;
int count;
-
+
// Note: This should only be used for Local RBAC (in memory)
public User(Principal principal) {
this.principal = principal;
@@ -86,23 +86,23 @@ public final class User<PERM extends Permission> {
count = 0;
renewPerm();
}
-
+
public void renewPerm() {
permExpires = System.currentTimeMillis()+interval;
}
-
+
public long permExpires() {
return permExpires;
}
-
+
public boolean permExpired() {
return System.currentTimeMillis() > permExpires;
}
public boolean noPerms() {
- return perms==null || perms==NULL_MAP || perms.values().size()==0;
+ return perms==null || perms==NULL_MAP || perms.values().size()==0;
}
-
+
public synchronized void setNoPerms() {
perms=NULL_MAP;
renewPerm();
@@ -115,11 +115,11 @@ public final class User<PERM extends Permission> {
public synchronized void incCount() {
++count;
}
-
+
public synchronized void resetCount() {
count=0;
}
-
+
public Map<String,Permission> newMap() {
return new ConcurrentHashMap<>();
}
@@ -146,11 +146,11 @@ public final class User<PERM extends Permission> {
}
return false;
}
-
+
public void copyPermsTo(List<Permission> sink) {
sink.addAll(perms.values());
}
-
+
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(principal.getName());
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/UserChain.java b/cadi/core/src/main/java/org/onap/aaf/cadi/UserChain.java
index f6a98085..f299f931 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/UserChain.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/UserChain.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,17 +23,17 @@ package org.onap.aaf.cadi;
/**
* Interface to add a User Chain String to Principal
- *
- *
- *
+ *
+ *
+ *
* Where
- * APP is name suitable for Logging (i.e. official App Acronym)
+ * APP is name suitable for Logging (i.e. official App Acronym)
* ID is official User or MechID, best if includes Identity Source (i.e. ab1234@people.osaaf.org)
* Protocol is the Security protocol,
- *
+ *
* Format:<ID>:<APP>:<protocol>[:AS][,<ID>:<APP>:<protocol>]*
- *
- *
+ *
+ *
* @author Jonathan
*
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
index 7bd578a5..a231b393 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -64,7 +64,7 @@ import org.onap.aaf.cadi.util.Split;
/**
* Create a Consistent Configuration mechanism, even when configuration styles are as vastly different as
* Properties vs JavaBeans vs FilterConfigs...
- *
+ *
* @author Jonathan
*
*/
@@ -110,16 +110,16 @@ public class Config {
public static final String CADI_PROTOCOLS = "cadi_protocols";
public static final String CADI_NOAUTHN = "cadi_noauthn";
public static final String CADI_LOC_LIST = "cadi_loc_list";
-
+
// Special Behaviors
public static final String CADI_BATH_CONVERT = "cadi_bath_convert";
public static final String CADI_API_ENFORCEMENT = "cadi_api_enforcement";
public static final String CADI_ADD_TAFS = "cadi_add_tafs";
public static final String CADI_ADD_LURS = "cadi_add_lurs";
-
+
public static final String CADI_USER_CHAIN_TAG = "cadi_user_chain";
public static final String CADI_USER_CHAIN = "USER_CHAIN";
-
+
public static final String CADI_OAUTH2_URL="cadi_oauth2_url";
public static final String CADI_TOKEN_DIR = "cadi_token_dir";
@@ -133,20 +133,20 @@ public class Config {
+ "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,TLS_ECDHE_RSA_WITH_RC4_128_SHA,TLS_ECDH_ECDSA_WITH_RC4_128_SHA,"
+ "TLS_ECDH_RSA_WITH_RC4_128_SHA,TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,"
+ "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA,TLS_EMPTY_RENEGOTIATION_INFO_SCSV";
-
+
public static final String LOCALHOST_ALLOW = "localhost_allow";
public static final String LOCALHOST_DENY = "localhost_deny";
-
- public static final String BASIC_REALM = "basic_realm"; // what is sent to the client
- public static final String BASIC_WARN = "basic_warn"; // Warning of insecure channel
+
+ public static final String BASIC_REALM = "basic_realm"; // what is sent to the client
+ public static final String BASIC_WARN = "basic_warn"; // Warning of insecure channel
public static final String USERS = "local_users";
public static final String GROUPS = "local_groups";
public static final String WRITE_TO = "local_writeto"; // dump RBAC to local file in Tomcat Style (some apps use)
-
+
public static final String OAUTH_CLIENT_ID="client_id";
public static final String OAUTH_CLIENT_SECRET="client_secret";
-
+
public static final String AAF_ENV = "aaf_env";
public static final String AAF_ROOT_NS = "aaf_root_ns";
public static final String AAF_ROOT_NS_DEF = "org.osaaf.aaf";
@@ -159,15 +159,15 @@ public class Config {
public static final String AAF_DEFAULT_API_VERSION = "2.1";
public static final String AAF_DEPLOYED_VERSION="aaf_deployed_version";
public static final String AAF_API_VERSION = "aaf_api_version";
- public static final String AAF_URL = "aaf_url"; //URL for AAF... Use to trigger AAF configuration
+ public static final String AAF_URL = "aaf_url"; //URL for AAF... Use to trigger AAF configuration
public static final String AAF_LOCATOR_CLASS = "aaf_locator_class";
// AAF Locator Entries are ADDITIONAL entries, which also gives the Property ability
// to set these entries manually
// example: adding a K8S name like "oom"
- // this will allow Registrations to pick up
+ // this will allow Registrations to pick up
// locator_ns.oom for onap's "OOM" based k8s entries, etc.
public static final String AAF_LOCATOR_CONTAINER="aaf_locator_container";
- // An ID for another Container, to be used to avoid picking up the wrong internal info
+ // An ID for another Container, to be used to avoid picking up the wrong internal info
// for another container.
public static final String AAF_LOCATOR_CONTAINER_ID = "aaf_locator_container_id";
public static final String AAF_LOCATOR_CONTAINER_NS = "aaf_locator_container_ns";
@@ -181,7 +181,7 @@ public class Config {
public static final String AAF_LOCATOR_PUBLIC_PORT = "aaf_locator_public_port";
public static final String AAF_LOCATOR_PUBLIC_FQDN = "aaf_locator_public_fqdn";
public static final String AAF_LOCATOR_PUBLIC_NAME = "aaf_locator_public_name";
-
+
// AAF Service will write to the Audit Log if a past due AAF stored Password
// is being used within # of days specified.
public static final String AAF_CRED_WARN_DAYS="aaf_cred_warn_days";
@@ -196,7 +196,7 @@ public class Config {
public static final String AAF_CONN_TIMEOUT_DEF = "3000";
public static final String AAF_CONN_IDLE_TIMEOUT = "aaf_conn_idle_timeout"; // only for Direct Jetty Access.
public static final String AAF_CONN_IDLE_TIMEOUT_DEF = "10000"; // only for Direct Jetty Access.
-
+
// Default Classes: These are for Class loading to avoid direct compile links
public static final String AAF_TAF_CLASS_DEF = "org.onap.aaf.cadi.aaf.v2_0.AAFTaf";
public static final String AAF_LOCATOR_CLASS_DEF = "org.onap.aaf.cadi.aaf.v2_0.AAFLocator";
@@ -212,7 +212,7 @@ public class Config {
public static final String AAF_CLEAN_INTERVAL_DEF = "30000"; // Default is 30 seconds
public static final String AAF_REFRESH_TRIGGER_COUNT = "aaf_refresh_trigger_count";
public static final String AAF_REFRESH_TRIGGER_COUNT_DEF = "3"; // Default is 10 mins
-
+
public static final String AAF_HIGH_COUNT = "aaf_high_count";
public static final String AAF_HIGH_COUNT_DEF = "1000"; // Default is 1000 entries
public static final String AAF_PERM_MAP = "aaf_perm_map";
@@ -251,7 +251,7 @@ public class Config {
public static final String AAF_OAUTH2_INTROSPECT_URL = "aaf_oauth2_introspect_url";
public static final String AAF_ALT_OAUTH2_TOKEN_URL = "aaf_alt_oauth2_token_url";
public static final String AAF_ALT_OAUTH2_INTROSPECT_URL = "aaf_alt_oauth2_introspect_url";
- public static final String AAF_ALT_OAUTH2_DOMAIN = "aaf_alt_oauth2_domain";
+ public static final String AAF_ALT_OAUTH2_DOMAIN = "aaf_alt_oauth2_domain";
public static final String AAF_ALT_CLIENT_ID = "aaf_alt_oauth2_client_id";
public static final String AAF_ALT_CLIENT_SECRET = "aaf_alt_oauth2_client_secret";
public static final String AAF_OAUTH2_HELLO_URL = "aaf_oauth2_hello_url";
@@ -300,9 +300,9 @@ public class Config {
// IMPORTANT! Don't attempt to load AAF Connector if there is no AAF URL
String aafURL = logProp(rph, AAF_URL,null);
if (!hasDirectAAF && aafcon==null && aafURL!=null) {
- aafcon = loadAAFConnector(si, aafURL);
+ aafcon = loadAAFConnector(si, aafURL);
}
-
+
HttpTaf taf;
// Setup Host, in case Network reports an unusable Hostname (i.e. VTiers, VPNs, etc)
String hostname = logProp(access, HOSTNAME,null);
@@ -313,7 +313,7 @@ public class Config {
throw new CadiException("Unable to determine Hostname",e1);
}
}
-
+
access.log(Level.INIT, "Hostname set to",hostname);
// Get appropriate TAFs
ArrayList<Priori<HttpTaf>> htlist = new ArrayList<>();
@@ -355,7 +355,7 @@ public class Config {
} else {
access.log(Level.INIT,"Certificate Authorization not enabled");
}
-
+
/////////////////////////////////////////////////////
// Configure Basic Auth (local content)
/////////////////////////////////////////////////////
@@ -406,7 +406,7 @@ public class Config {
} else {
access.log(Level.INIT,"Local Basic Authorization is disabled. Enable by setting basicRealm=<appropriate realm, i.e. my.att.com>");
}
-
+
/////////////////////////////////////////////////////
// Configure AAF Driven Basic Auth
/////////////////////////////////////////////////////
@@ -414,10 +414,10 @@ public class Config {
access.log(Level.INIT,"AAF Connection (AAFcon) is null. Cannot create an AAF TAF");
} else if (aafURL==null) {
access.log(Level.INIT,"No AAF URL in properties, Cannot create an AAF TAF");
- } else {// There's an AAF_URL... try to configure an AAF
+ } else {// There's an AAF_URL... try to configure an AAF
String aafTafClassName = logProp(access, AAF_TAF_CLASS,AAF_TAF_CLASS_DEF);
// Only 2.0 available at this time
- if (AAF_TAF_CLASS_DEF.equals(aafTafClassName)) {
+ if (AAF_TAF_CLASS_DEF.equals(aafTafClassName)) {
try {
Class<?> aafTafClass = loadClass(access,aafTafClassName);
if (aafTafClass!=null) {
@@ -447,7 +447,7 @@ public class Config {
}
}
}
-
+
/////////////////////////////////////////////////////
// Configure OAuth TAF
/////////////////////////////////////////////////////
@@ -490,7 +490,7 @@ public class Config {
access.log(Level.INIT,"OAuth TAF is not configured");
}
}
-
+
/////////////////////////////////////////////////////
// Adding BasicAuth (AAF) last, after other primary Cookie Based
// Needs to be before Cert... see below
@@ -498,7 +498,7 @@ public class Config {
if (aaftaf!=null) {
htlist.add(new Priori<HttpTaf>(aaftaf,40));
}
- }
+ }
/////////////////////////////////////////////////////
// Any Additional Tafs passed in Constructor
@@ -534,7 +534,7 @@ public class Config {
}
}
}
-
+
// Add BasicAuth, if any, to x509Taf
if (x509TAF!=null) {
for ( Priori<HttpTaf> ht : htlist) {
@@ -543,12 +543,12 @@ public class Config {
}
}
}
-
+
/////////////////////////////////////////////////////
// Additional TAFs by Plugin
/////////////////////////////////////////////////////
Priori.add(access, CADI_ADD_TAFS, htlist);
-
+
/////////////////////////////////////////////////////
// Create EpiTaf from configured TAFs
/////////////////////////////////////////////////////
@@ -571,17 +571,17 @@ public class Config {
access.log(Level.INIT, sb);
Locator<URI> locator = loadLocator(si, aafURL);
-
+
taf = new HttpEpiTaf(access,locator, tc, htarray); // ok to pass locator == null
String level = logProp(access, CADI_LOGLEVEL, null);
if (level!=null) {
access.setLogLevel(Level.valueOf(level));
}
}
-
+
return taf;
}
-
+
public static String logProp(RegistrationPropHolder rph, String tag, String def) {
String rv = rph.access().getProperty(tag, def);
if (rv == null) {
@@ -591,9 +591,9 @@ public class Config {
rph.access().log(Level.INIT,tag,"is set to",rv);
}
return rv;
-
+
}
-
+
public static String logProp(Access access,String tag, String def) {
String rv = access.getProperty(tag, def);
if (rv == null) {
@@ -603,7 +603,7 @@ public class Config {
}
return rv;
}
-
+
public static Lur configLur(SecurityInfoC<HttpURLConnection> si, Connector con, Object ... additionalTafLurs) throws CadiException {
Access access = si.access;
RegistrationPropHolder rph;
@@ -614,7 +614,7 @@ public class Config {
}
List<Priori<Lur>> lurs = new ArrayList<>();
-
+
/////////////////////////////////////////////////////
// Configure a Local Property Based RBAC/LUR
/////////////////////////////////////////////////////
@@ -625,7 +625,7 @@ public class Config {
if (groups!=null || users!=null) {
LocalLur ll = new LocalLur(access, users, groups); // note b64==null is ok.. just means no encryption.
lurs.add(new Priori<Lur>(ll,10));
-
+
String writeto = access.getProperty(WRITE_TO,null);
if (writeto!=null) {
String msg = UsersDump.updateUsers(writeto, ll);
@@ -660,14 +660,14 @@ public class Config {
msg = e.getCause().getMessage();
}
access.log(Level.INIT,"AAF/OAuth LUR is not instantiated.",msg,e);
- }
+ }
} else {
access.log(Level.INIT, "OAuth2 Lur disabled");
}
if (con!=null) { // try to reutilize connector
lurs.add(new Priori<Lur>(con.newLur(),30));
- } else {
+ } else {
/////////////////////////////////////////////////////
// Configure the AAF Lur (if any)
/////////////////////////////////////////////////////
@@ -693,7 +693,7 @@ public class Config {
} else {// There's an AAF_URL... try to configure an AAF
String aafLurClassStr = logProp(access,AAF_LUR_CLASS,AAF_V2_0_AAF_LUR_PERM);
////////////AAF Lur 2.0 /////////////
- if (aafLurClassStr!=null && aafLurClassStr.startsWith(AAF_V2_0)) {
+ if (aafLurClassStr!=null && aafLurClassStr.startsWith(AAF_V2_0)) {
try {
Object aafcon = loadAAFConnector(si, aafURL);
if (aafcon==null) {
@@ -703,7 +703,7 @@ public class Config {
if (aafAbsAAFCon!=null) {
Method mNewLur = aafAbsAAFCon.getMethod("newLur");
Object aaflur = mNewLur.invoke(aafcon);
-
+
if (aaflur==null) {
access.log(Level.INIT,"ERROR! AAF LUR Failed construction. NOT Configured");
} else {
@@ -719,7 +719,7 @@ public class Config {
} catch (Exception e) {
access.log(e,"AAF LUR class,",aafLurClassStr,"could not be constructed with given Constructors.");
}
- }
+ }
}
}
}
@@ -740,13 +740,13 @@ public class Config {
/////////////////////////////////////////////////////
// Additional LURs by Plugin
/////////////////////////////////////////////////////
- Priori.add(access, CADI_ADD_LURS, lurs);
+ Priori.add(access, CADI_ADD_LURS, lurs);
/////////////////////////////////////////////////////
- // Return a Lur based on how many there are...
+ // Return a Lur based on how many there are...
/////////////////////////////////////////////////////
switch(lurs.size()) {
- case 0:
+ case 0:
access.log(Level.INIT,"WARNING! No CADI LURs configured");
// Return a NULL Lur that does nothing.
return new NullLur();
@@ -770,7 +770,7 @@ public class Config {
return new EpiLur(la);
}
}
-
+
private static boolean hasDirect(String simpleClassName, Object[] additionalTafLurs) {
if (additionalTafLurs!=null) {
for (Object tf : additionalTafLurs) {
@@ -922,7 +922,7 @@ public class Config {
locator = (Locator<URI>)cnst.newInstance(new Object[] {si,locatorURI});
int port = fui.getPort();
String portS = port<0?"":(":"+port);
-
+
access.log(Level.INFO, "AAFLocator enabled using " + locatorURI.getScheme() +"://"+fui.getHost() + portS);
} else {
access.log(Level.INFO, "AAFLocator enabled using preloaded " + locator.getClass().getSimpleName());
@@ -943,7 +943,7 @@ public class Config {
public static String getDefaultRealm() {
return defaultRealm;
}
-
+
public static String getAAFLocateUrl(Access access) {
String rv = null;
String cont = access.getProperty(AAF_LOCATOR_CONTAINER,null);
@@ -959,7 +959,7 @@ public class Config {
private static class Priori<T> implements Comparable<Priori<T>> {
public final T t;
public final int priority;
-
+
public Priori(final T t, final int priority) {
this.t = t;
this.priority = priority;
@@ -997,7 +997,7 @@ public class Config {
access.printf(Level.ERROR, "%s format is <classname>,priority[;...]\n",CADI_ADD_TAFS);
}
}
-
+
if(clssn!=null) {
Class<?> cls = loadClass(access, clssn);
if(cls!=null) {
@@ -1009,7 +1009,7 @@ public class Config {
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
String hostname = access.getProperty(Config.HOSTNAME,null);
if(hostname==null) {
- access.printf(Level.ERROR, "%s cannot be constructed on this machine. Set valid 'hostname' in your properties\n",clssn);
+ access.printf(Level.ERROR, "%s cannot be constructed on this machine. Set valid 'hostname' in your properties\n",clssn);
} else {
access.printf(Level.ERROR, "%s cannot be constructed on %s with Access.\n",clssn, hostname);
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Get.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Get.java
index b48dd74d..0f65b374 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Get.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Get.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,8 +28,8 @@ import org.onap.aaf.cadi.Access.Level;
public interface Get {
public String get(String name, String def, boolean print);
-
-
+
+
/**
* A class for Getting info out of "JavaBean" format
* @author Jonathan
@@ -40,24 +40,24 @@ public interface Get {
private Class<?> bc;
private Class<?>[] params;
private Object[] args;
-
+
public Bean(Object bean) {
this.bean = bean;
bc = bean.getClass();
params = new Class<?>[0]; // note, this will allow to go out of scope after config
args = new Object[0];
}
-
+
public String get(String name, String def, boolean print) {
String str = null;
String gname = "get"+Character.toUpperCase(name.charAt(0))+name.substring(1);
try {
Method meth = bc.getMethod(gname, params);
Object obj = meth.invoke(bean, args);
- str = obj==null?null:obj.toString(); // easy string convert...
+ str = obj==null?null:obj.toString(); // easy string convert...
} catch (Exception e) {
}
-
+
// Take def if nothing else
if (str==null) {
str = def;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/GetAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/GetAccess.java
index 30adcc97..65501a67 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/GetAccess.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/GetAccess.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,12 +25,12 @@ import org.onap.aaf.cadi.PropAccess;
public class GetAccess extends PropAccess {
private final Get getter;
-
+
public GetAccess(Get getter) {
super(new String[]{"cadi_prop_files="+getter.get("cadi_prop_files", null, true)});
this.getter = getter;
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.cadi.PropAccess#getProperty(java.lang.String, java.lang.String)
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/MultiGet.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/MultiGet.java
index c5e5a50e..d73e1b71 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/MultiGet.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/MultiGet.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,7 +33,7 @@ public class MultiGet implements Get {
String str;
for (Get getter : getters) {
str = getter.get(name, null, print);
- if (str!=null)
+ if (str!=null)
return str;
}
return def;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java
index f73179a9..2825e9a5 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -99,11 +99,11 @@ public class RegistrationPropHolder {
}
}
default_name = container_public_name;
-
+
if(firstlog) {
access.printf(Level.INIT, REGI,"default_name",default_name);
}
-
+
latitude=null;
String slatitude = access.getProperty(Config.CADI_LATITUDE, null);
if(slatitude == null) {
@@ -138,7 +138,7 @@ public class RegistrationPropHolder {
}
}
}
-
+
default_fqdn = access.getProperty(Config.AAF_LOCATOR_FQDN, hostname);
if(firstlog) {
access.printf(Level.INIT, REGI,"default_fqdn",default_fqdn);
@@ -157,7 +157,7 @@ public class RegistrationPropHolder {
errs.append('\n');
errs.append(propname);
errs.append(" must be defined.");
-
+
}
public String getEntryFQDN(final String entry, final String dot_le) {
@@ -169,7 +169,7 @@ public class RegistrationPropHolder {
}
return replacements("RegistrationPropHolder.getEntryFQDN",str,entry,dot_le);
}
-
+
public String getEntryName(final String entry, final String dot_le) {
String str;
if(dot_le.isEmpty()) {
@@ -179,7 +179,7 @@ public class RegistrationPropHolder {
}
return replacements("RegistrationPropHolder.getEntryName",str,entry,dot_le);
}
-
+
public String getPublicEntryName(final String entry, final String dot_le) {
String str = access.getProperty(Config.AAF_LOCATOR_PUBLIC_NAME+dot_le, null);
if(str==null) {
@@ -190,8 +190,8 @@ public class RegistrationPropHolder {
}
return replacements("RegistrationPropHolder.getEntryName",str,entry,dot_le);
}
-
-
+
+
private String getNS(String dot_le) {
String ns;
ns = access.getProperty(Config.AAF_LOCATOR_APP_NS+dot_le,null);
@@ -201,7 +201,7 @@ public class RegistrationPropHolder {
return ns;
}
-
+
public String replacements(final String fromCode, final String source, final String name, final String _dot_le) {
if(source == null) {
return "";
@@ -238,13 +238,13 @@ public class RegistrationPropHolder {
value = value.replace("http://AAF_LOCATE_URL/", str);
} else {
value = value.replace("https://AAF_LOCATE_URL/", str);
-
+
}
}
}
}
- int atC = value.indexOf("%C");
+ int atC = value.indexOf("%C");
if(atC>=0) {
// aaf_locator_container_ns
str = access.getProperty(Config.AAF_LOCATOR_CONTAINER_NS+dot_le, default_container_ns);
@@ -252,14 +252,14 @@ public class RegistrationPropHolder {
value = value.replace("%CNS"+'.', str);
}
value = value.replace("%CNS", str);
-
+
str = access.getProperty(Config.AAF_LOCATOR_CONTAINER+dot_le,default_container);
if(str.isEmpty()) {
value = value.replace("%C"+'.', str);
}
value = value.replace("%C", str);
}
-
+
if(value.indexOf("%NS")>=0) {
str = getNS(dot_le);
if(str==null || str.isEmpty()) {
@@ -280,7 +280,7 @@ public class RegistrationPropHolder {
}
}
-
+
if(value.indexOf('%')>=0) {
// These shouldn't be expected to have dot elements
if(name!=null) {
@@ -293,13 +293,13 @@ public class RegistrationPropHolder {
value = value.replace("%PH", public_fqdn);
}
}
- access.printf(Level.DEBUG,
+ access.printf(Level.DEBUG,
"RegistrationReplacement from %s, source: %s, dot_le: %s, value: %s",
fromCode,source,dot_le,value);
return value;
}
-
+
public int getEntryPort(final String dot_le) {
return public_port!=null && dot_le.isEmpty()?
public_port:
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java
index 8dbc38e1..60c75719 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -64,7 +64,7 @@ public class SecurityInfo {
private static final String LOADED_FROM_SYSTEM_PROPERTIES = "%s loaded from System Properties";
public static final String SSL_KEY_MANAGER_FACTORY_ALGORITHM;
-
+
private SSLSocketFactory socketFactory;
private X509KeyManager[] x509KeyManager;
private X509TrustManager[] x509TrustManager;
@@ -83,21 +83,21 @@ public class SecurityInfo {
SSL_KEY_MANAGER_FACTORY_ALGORITHM = "SunX509";
}
}
-
+
public SecurityInfo(final Access access) throws CadiException {
String msgHelp = "";
try {
this.access = access;
// reuse DME2 Properties for convenience if specific Properties don't exist
-
+
String str = access.getProperty(Config.CADI_ALIAS, null);
if(str==null || str.isEmpty()) {
defaultAlias = null;
} else {
defaultAlias = str;
}
-
+
str = access.getProperty(Config.CADI_CLIENT_ALIAS, null);
if(str==null) {
defaultClientAlias = defaultAlias;
@@ -110,17 +110,17 @@ public class SecurityInfo {
msgHelp = String.format(INITIALIZING_ERR_FMT,"Keystore", access.getProperty(Config.CADI_KEYSTORE, ""));
initializeKeyManager();
-
+
msgHelp = String.format(INITIALIZING_ERR_FMT,"Truststore", access.getProperty(Config.CADI_TRUSTSTORE, ""));
initializeTrustManager();
-
+
msgHelp = String.format(INITIALIZING_ERR_FMT,"Trustmasks", access.getProperty(Config.CADI_TRUST_MASKS, ""));
initializeTrustMasks();
msgHelp = String.format(INITIALIZING_ERR_FMT,"HTTP Protocols", "access properties");
setHTTPProtocols(access);
-
+
msgHelp = String.format(INITIALIZING_ERR_FMT,"Context", "TLS");
context = SSLContext.getInstance("TLS");
context.init(x509KeyManager, x509TrustManager, null);
@@ -146,7 +146,7 @@ public class SecurityInfo {
// This needs to be set when people do not.
System.setProperty(HTTPS_PROTOCOLS, httpsProtocols);
}
- String httpsClientProtocols = System.getProperty(JDK_TLS_CLIENT_PROTOCOLS,null);
+ String httpsClientProtocols = System.getProperty(JDK_TLS_CLIENT_PROTOCOLS,null);
if(httpsClientProtocols!=null) {
access.printf(Level.INIT, LOADED_FROM_SYSTEM_PROPERTIES, JDK_TLS_CLIENT_PROTOCOLS);
} else {
@@ -197,7 +197,7 @@ public class SecurityInfo {
hsuc.setHostnameVerifier(maskHV);
}
}
-
+
protected void initializeKeyManager() throws CadiException, IOException, NoSuchAlgorithmException, KeyStoreException, CertificateException, UnrecoverableKeyException {
String keyStore = access.getProperty(Config.CADI_KEYSTORE, null);
if(keyStore==null) {
@@ -208,7 +208,7 @@ public class SecurityInfo {
String keyStorePasswd = access.getProperty(Config.CADI_KEYSTORE_PASSWORD, null);
keyStorePasswd = (keyStorePasswd == null) ? null : access.decrypt(keyStorePasswd, false);
- if (keyStore == null || keyStorePasswd == null) {
+ if (keyStore == null || keyStorePasswd == null) {
x509KeyManager = new X509KeyManager[0];
return;
}
@@ -240,7 +240,7 @@ public class SecurityInfo {
}
}
}
-
+
StringBuilder sb = null;
for (KeyManager keyManager : keyManagerFactory.getKeyManagers()) {
if (keyManager instanceof X509KeyManager) {
@@ -263,12 +263,12 @@ public class SecurityInfo {
}
x509KeyManager = new X509KeyManager[keyManagers.size()];
keyManagers.toArray(x509KeyManager);
-
+
if(sb!=null) {
access.log(Level.INIT, sb);
}
}
-
+
private void x509Info(StringBuilder sb, X509Certificate[] chain) {
if(chain!=null) {
int i=0;
@@ -290,7 +290,7 @@ public class SecurityInfo {
protected void initializeTrustManager() throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException, CadiException {
String trustStore = access.getProperty(Config.CADI_TRUSTSTORE, null);
if(trustStore==null) {
- return;
+ return;
} else if(!new File(trustStore).exists()) {
throw new CadiException(trustStore + " does not exist");
}
@@ -307,7 +307,7 @@ public class SecurityInfo {
try {
KeyStore ts = KeyStore.getInstance("JKS");
ts.load(fis, trustStorePasswd.toCharArray());
- trustManagerFactory.init(ts);
+ trustManagerFactory.init(ts);
} finally {
fis.close();
}
@@ -328,7 +328,7 @@ public class SecurityInfo {
}
}
}
-
+
protected void initializeTrustMasks() throws AccessException {
String tips = access.getProperty(Config.CADI_TRUST_MASKS, null);
if (tips == null) {
@@ -345,7 +345,7 @@ public class SecurityInfo {
throw new AccessException("Invalid IP Mask in " + Config.CADI_TRUST_MASKS, e);
}
}
-
+
final HostnameVerifier origHV = HttpsURLConnection.getDefaultHostnameVerifier();
maskHV = new HostnameVerifier() {
@Override
@@ -366,5 +366,5 @@ public class SecurityInfo {
};
HttpsURLConnection.setDefaultHostnameVerifier(maskHV);
}
-
+
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoC.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoC.java
index 4e365fba..7c5f50ed 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoC.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoC.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,13 +34,13 @@ public class SecurityInfoC<CLIENT> extends SecurityInfo {
public static final String DEF_ID = "ID not Set";
private static Map<Class<?>,SecurityInfoC<?>> sicMap = new HashMap<>();
public SecuritySetter<CLIENT> defSS;
-
+
public SecurityInfoC(Access access) throws CadiException {
super(access);
defSS = new DEFSS<CLIENT>();
}
-
+
@SuppressWarnings("unchecked")
public static synchronized <CLIENT> SecurityInfoC<CLIENT> instance(Access access, Class<CLIENT> cls) throws CadiException {
SecurityInfoInit<CLIENT> sii;
@@ -58,9 +58,9 @@ public class SecurityInfoC<CLIENT> extends SecurityInfo {
public SecuritySetter<CLIENT> bestDefault(SecurityInfoC<CLIENT> si) throws CadiException {
return new DEFSS<CLIENT>();
}
- };
+ };
}
-
+
SecurityInfoC<CLIENT> sic = (SecurityInfoC<CLIENT>) sicMap.get(cls);
if (sic==null) {
sic = new SecurityInfoC<CLIENT>(access);
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoInit.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoInit.java
index 614f363b..e5b7a0ea 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoInit.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoInit.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/UsersDump.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/UsersDump.java
index 98ab4706..4f7db1ab 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/UsersDump.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/UsersDump.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -56,7 +56,7 @@ public class UsersDump {
// We loop through Users, but want to write Groups first... therefore, save off print
StringBuilder sb = new StringBuilder();
-
+
// Obtain all unique role names
HashSet<String> groups = new HashSet<>();
for (AbsUserCache<?>.DumpInfo di : lur.dumpInfo()) {
@@ -80,7 +80,7 @@ public class UsersDump {
ps.print(group);
ps.println("\"/>");
}
-
+
ps.println(sb);
ps.println("</tomcat-users>");
@@ -91,13 +91,13 @@ public class UsersDump {
}
return true;
}
-
+
/**
- *
+ *
* Note: This method returns a String if there's an error, or null if ok.
- * This unusual style is necessitated by the fact that any Exceptions thrown are likely to
+ * This unusual style is necessitated by the fact that any Exceptions thrown are likely to
* be unlogged and hidden from view, making debugging almost impossible.
- *
+ *
* @param writeto
* @param up
* @return
@@ -129,7 +129,7 @@ public class UsersDump {
int startA=0, startB=0;
for (int i=0;startA<orig.length && i<3;++startA) if (orig[startA]=='<')++i;
for (int i=0;startB<orig.length && i<3;++startB) if (postulate[startB]=='<')++i;
-
+
writeIt=orig.length-startA!=postulate.length-startB; // first, check if remaining length is the same
while (!writeIt && startA<orig.length && startB<postulate.length) {
if (orig[startA++]!=postulate[startB++])writeIt = true;
@@ -141,7 +141,7 @@ public class UsersDump {
} else {
writeIt = true;
}
-
+
if (writeIt) {
try {
FileOutputStream fos = new FileOutputStream(file);
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZ.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZ.java
index 5aa502d4..fefb0970 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZ.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZ.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZServlet.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZServlet.java
index 0bd87d98..8073249c 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZServlet.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZServlet.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,7 +32,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
- *
+ *
* @author Jonathan
*
*/
@@ -53,14 +53,14 @@ public class AUTHZServlet<S extends Servlet> implements Servlet {
roles = rolesAllowed.value();
}
}
-
+
public void init(ServletConfig sc) throws ServletException {
if (delegate == null) {
throw new ServletException("Invalid Servlet Delegate");
}
delegate.init(sc);
}
-
+
public ServletConfig getServletConfig() {
return delegate.getServletConfig();
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AccessGetter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AccessGetter.java
index ae4347d3..96eebf5e 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AccessGetter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AccessGetter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiApiEnforcementFilter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiApiEnforcementFilter.java
index 292f8e1c..d97fe28b 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiApiEnforcementFilter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiApiEnforcementFilter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,15 +41,15 @@ import org.onap.aaf.cadi.util.Split;
/**
* This filter allows one to protect the APIs from data stored in AAF
- *
+ *
* @author Instrumental(Jonathan)
*/
public class CadiApiEnforcementFilter implements Filter {
private String type;
private Map<String,List<String>> publicPaths;
private Access access;
-
-
+
+
public CadiApiEnforcementFilter(Access access, String enforce) throws ServletException {
this.access = access;
init(enforce);
@@ -60,12 +60,12 @@ public class CadiApiEnforcementFilter implements Filter {
public void init(FilterConfig fc) throws ServletException {
init(fc.getInitParameter(Config.CADI_API_ENFORCEMENT));
// need the Context for Logging, instantiating ClassLoader, etc
- ServletContextAccess sca=new ServletContextAccess(fc);
+ ServletContextAccess sca=new ServletContextAccess(fc);
if (access==null) {
access = sca;
}
}
-
+
private void init(final String ptypes) throws ServletException {
if(ptypes==null) {
throw new ServletException("CadiApiEnforcement requires " + Config.CADI_API_ENFORCEMENT + " property");
@@ -99,10 +99,10 @@ public class CadiApiEnforcementFilter implements Filter {
HttpServletRequest hreq = (HttpServletRequest)req;
final String meth = hreq.getMethod();
String path = hreq.getContextPath()+hreq.getPathInfo();
-
+
if(path == null || path.isEmpty() || "null".equals(path))
path = hreq.getRequestURI().substring(hreq.getContextPath().length());
-
+
List<String> list = publicPaths.get(meth);
if(list!=null) {
for( String p : publicPaths.get(meth)) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java
index 50efe8b4..a2f168a1 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,16 +52,16 @@ import org.onap.aaf.cadi.util.Timing;
/**
* CadiFilter
- *
+ *
* This class implements Servlet Filter, and ties together CADI implementations
- *
+ *
* This class can be used in a standard J2EE Servlet manner. Optimal usage is for POJO operations, where
- * one can enforce this Filter being first and primary. Depending on the Container, it
- * may be more effective, in some cases, to utilize features that allow earlier determination of
+ * one can enforce this Filter being first and primary. Depending on the Container, it
+ * may be more effective, in some cases, to utilize features that allow earlier determination of
* AUTHN (Authorization). An example would be "Tomcat Valve". These implementations, however, should
* be modeled after the "init" and "doFilter" functions, and be kept up to date as this class changes.
- *
- *
+ *
+ *
* @author Jonathan
*
*/
@@ -73,18 +73,18 @@ public class CadiFilter implements Filter {
private Object[] additionalTafLurs;
private SideChain sideChain;
private static int count=0;
-
+
public Lur getLur() {
return httpChecker.getLur();
}
-
+
/**
* Construct a viable Filter
- *
- * Due to the vagaries of many containers, there is a tendency to create Objects and call "Init" on
+ *
+ * Due to the vagaries of many containers, there is a tendency to create Objects and call "Init" on
* them at a later time. Therefore, this object creates with an object that denies all access
* until appropriate Init happens, just in case the container lets something slip by in the meantime.
- *
+ *
*/
public CadiFilter() {
additionalTafLurs = CadiHTTPManip.noAdditional;
@@ -92,10 +92,10 @@ public class CadiFilter implements Filter {
/**
* This constructor to be used when directly constructing and placing in HTTP Engine
- *
+ *
* @param access
* @param moreTafLurs
- * @throws ServletException
+ * @throws ServletException
*/
public CadiFilter(Access access, Object ... moreTafLurs) throws ServletException {
additionalTafLurs = moreTafLurs;
@@ -120,7 +120,7 @@ public class CadiFilter implements Filter {
/**
* Init
- *
+ *
* Standard Filter "init" call with FilterConfig to obtain properties. POJOs can construct a
* FilterConfig with the mechanism of their choice, and standard J2EE Servlet engines utilize this
* mechanism already.
@@ -128,15 +128,15 @@ public class CadiFilter implements Filter {
//TODO Always validate changes against Tomcat AbsCadiValve and Jaspi CadiSAM Init functions
public void init(FilterConfig filterConfig) throws ServletException {
// need the Context for Logging, instantiating ClassLoader, etc
- ServletContextAccess sca=new ServletContextAccess(filterConfig);
+ ServletContextAccess sca=new ServletContextAccess(filterConfig);
if (access==null) {
access = sca;
}
-
+
// Set Protected getter with base Access, for internal class instantiations
init(new FCGet(access, sca.context(), filterConfig));
}
-
+
@SuppressWarnings("unchecked")
protected void init(Get getter) throws ServletException {
@@ -154,7 +154,7 @@ public class CadiFilter implements Filter {
} catch (Exception e) {
access.log(Level.INIT, "AAFTrustChecker cannot be loaded",e.getMessage());
}
-
+
try {
Class<Filter> cf=null;
try {
@@ -167,7 +167,7 @@ public class CadiFilter implements Filter {
access.log(Level.INIT, "AAFTrustChecker cannot be loaded",e.getMessage());
}
-
+
// Synchronize, because some instantiations call init several times on the same object
// In this case, the epiTaf will be changed to a non-NullTaf, and thus not instantiate twice.
synchronized(CadiHTTPManip.noAdditional /*will always remain same Object*/) {
@@ -194,8 +194,8 @@ public class CadiFilter implements Filter {
pathExceptions = str.split("\\s*:\\s*");
}
}
-
- /*
+
+ /*
* SETUP Permission Converters... those that can take Strings from a Vendor Product, and convert to appropriate AAF Permissions
*/
if (mapPairs==null) {
@@ -227,7 +227,7 @@ public class CadiFilter implements Filter {
}
// Add API Enforcement Point
- String enforce = getter.get(Config.CADI_API_ENFORCEMENT, null, true);
+ String enforce = getter.get(Config.CADI_API_ENFORCEMENT, null, true);
if(enforce!=null && enforce.length()>0) {
sideChain.add(new CadiApiEnforcementFilter(access,enforce));
}
@@ -236,7 +236,7 @@ public class CadiFilter implements Filter {
}
/**
- * Containers call "destroy" when time to cleanup
+ * Containers call "destroy" when time to cleanup
*/
public void destroy() {
// Synchronize, in case multiCadiFilters are used.
@@ -252,7 +252,7 @@ public class CadiFilter implements Filter {
/**
* doFilter
- *
+ *
* This is the standard J2EE invocation. Analyze the request, modify response as necessary, and
* only call the next item in the filterChain if request is suitably Authenticated.
*/
@@ -295,7 +295,7 @@ public class CadiFilter implements Filter {
}
- /**
+ /**
* If PathExceptions exist, report if these should not have Authn applied.
* @param hreq
* @return
@@ -317,7 +317,7 @@ public class CadiFilter implements Filter {
}
return false;
}
-
+
/**
* Get Converter by Path
*/
@@ -332,7 +332,7 @@ public class CadiFilter implements Filter {
}
return NullPermConverter.singleton();
}
-
+
/**
* store PermConverters by Path prefix
* @author Jonathan
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiHTTPManip.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiHTTPManip.java
index 0a89af0c..7c63a822 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiHTTPManip.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiHTTPManip.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,10 +47,10 @@ import org.onap.aaf.cadi.util.UserChainManip;
/**
* Encapsulate common HTTP Manipulation Behavior. It will appropriately set
* HTTPServletResponse for Redirect or Forbidden, as needed.
- *
+ *
* Further, this is useful, because it avoids multiple creates of Connections, where some Filters
* are created and destroyed regularly.
- *
+ *
* @author Jonathan
*
*/
@@ -73,7 +73,7 @@ public class CadiHTTPManip {
private CredVal up;
private Lur lur;
private String thisPerm,companyPerm,aaf_id;
-
+
public static final Object[] noAdditional = new Object[0]; // CadiFilter can be created each call in some systems
@@ -82,7 +82,7 @@ public class CadiHTTPManip {
this.access = access;
// Get getter = new AccessGetter(access);
Config.setDefaultRealm(access);
-
+
aaf_id = access.getProperty(Config.CADI_ALIAS,access.getProperty(Config.AAF_APPID, null));
if (aaf_id==null) {
access.printf(Level.INIT, "%s is not set. %s can be used instead",Config.AAF_APPID,Config.CADI_ALIAS);
@@ -107,9 +107,9 @@ public class CadiHTTPManip {
}
SecurityInfoC<HttpURLConnection> si;
si = SecurityInfoC.instance(access, HttpURLConnection.class);
-
+
lur = Config.configLur(si, con, additionalTafLurs);
-
+
tc.setLur(lur);
if (lur instanceof EpiLur) {
up = ((EpiLur)lur).getUserPassImpl();
@@ -126,33 +126,33 @@ public class CadiHTTPManip {
TafResp tresp = taf.validate(Taf.LifeForm.LFN, hreq, hresp);
switch(tresp.isAuthenticated()) {
case IS_AUTHENTICATED:
- access.printf(Level.DEBUG,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
+ access.printf(Level.DEBUG,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
hreq.getRemotePort(),AUTHENTICATED,tresp.desc());
break;
case TRY_AUTHENTICATING:
switch (tresp.authenticate()) {
case IS_AUTHENTICATED:
- access.printf(Level.DEBUG,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
+ access.printf(Level.DEBUG,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
hreq.getRemotePort(),AUTHENTICATED,tresp.desc());
break;
case HTTP_REDIRECT_INVOKED:
- access.printf(Level.DEBUG,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
+ access.printf(Level.DEBUG,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
hreq.getRemotePort(),AUTHENTICATING_VIA_REDIRECTION,tresp.desc());
break;
case NO_FURTHER_PROCESSING:
- access.printf(Level.AUDIT,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
+ access.printf(Level.AUDIT,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
hreq.getRemotePort(),AUTHENTICATION_FAILURE,tresp.desc());
hresp.sendError(403, tresp.desc()); // Forbidden
break;
default:
- access.printf(Level.AUDIT,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
+ access.printf(Level.AUDIT,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
hreq.getRemotePort(),NO_TAF_WILL_AUTHORIZE,tresp.desc());
hresp.sendError(403, tresp.desc()); // Forbidden
}
break;
case NO_FURTHER_PROCESSING:
- access.printf(Level.AUDIT,MSG_FMT, tresp.getTarget(),hreq.getRemoteAddr(),
+ access.printf(Level.AUDIT,MSG_FMT, tresp.getTarget(),hreq.getRemoteAddr(),
hreq.getRemotePort(),NO_TAF_WILL_AUTHORIZE,tresp.desc());
hresp.sendError(403, ACCESS_DENIED); // FORBIDDEN
break;
@@ -161,12 +161,12 @@ public class CadiHTTPManip {
hreq.getRemotePort(),NO_TAF_WILL_AUTHORIZE,tresp.desc());
hresp.sendError(403, ACCESS_DENIED); // FORBIDDEN
}
-
+
return tresp;
}
-
+
public boolean notCadi(CadiWrap req, HttpServletResponse resp) {
-
+
String pathInfo = req.getPathInfo();
if (METH.equalsIgnoreCase(req.getMethod()) && pathInfo!=null && pathInfo.contains(CADI)) {
if (req.getUser().equals(aaf_id) || req.isUserInRole(thisPerm) || req.isUserInRole(companyPerm)) {
@@ -201,11 +201,11 @@ public class CadiHTTPManip {
}
return true;
}
-
+
public Lur getLur() {
return lur;
}
-
+
public void destroy() {
access.log(Level.INFO,"CadiHttpChecker destroyed.");
if (lur!=null) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java
index 1805c782..e9cb59ce 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,7 +34,7 @@ import org.onap.aaf.cadi.config.Get;
*/
public class FCGet implements Get {
/**
- *
+ *
*/
private final Access access;
private FilterConfig filterConfig;
@@ -52,12 +52,12 @@ public class FCGet implements Get {
if (context!=null) {
str = context.getInitParameter(name);
}
-
+
// Try Filter Context next
if (str==null && filterConfig != null) {
str = filterConfig.getInitParameter(name);
}
-
+
if (str==null) {
str = access.getProperty(name, def);
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java
index 8c616f4a..7ad1921c 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,21 +39,21 @@ import org.onap.aaf.cadi.util.CSV;
import org.onap.aaf.cadi.util.CSV.Visitor;
/**
- * This Filter is designed to help MIGRATE users from systems that don't match the FQI style.
- *
+ * This Filter is designed to help MIGRATE users from systems that don't match the FQI style.
+ *
* Style 1, where just the ID is translated, i.e. OLD => new@something.onap.org, that is acceptable
* longer term, because it does not store Creds locally. The passwords are in appropriate systems, but
* it's still painful operationally, though it does ease migration.
*
* Style 3, however, which is Direct match of Authorization Header to replacement, is only there
* because some passwords are simply not acceptable for AAF, (too easy, for instance), and it is
- * not feasible to break Organization Password rules for a Migration. Therefore, this method
+ * not feasible to break Organization Password rules for a Migration. Therefore, this method
* should not considered something that is in any way a permanent
- *
+ *
- *
+ *
* It goes without saying that any file with the password conversion should be protected by "400", etc.
- *
+ *
* @author Instrumental (Jonathan)
*
*/
@@ -63,15 +63,15 @@ public class MapBathConverter {
/**
* Create with colon separated name value pairs
- * Enter the entire "Basic dXNlcjpwYXNz" "Authorization" header, where "dXNlcjpwYXNz" is
+ * Enter the entire "Basic dXNlcjpwYXNz" "Authorization" header, where "dXNlcjpwYXNz" is
* base64 encoded, which can be created with "cadi" tool (in jar)
- *
- * The replacement should also be an exact replacement of what you want. Recognize that
- * this should be TEMPORARY as you are storing credentials outside the users control.
- *
+ *
+ * The replacement should also be an exact replacement of what you want. Recognize that
+ * this should be TEMPORARY as you are storing credentials outside the users control.
+ *
* @param value
- * @throws IOException
- * @throws CadiException
+ * @throws IOException
+ * @throws CadiException
*/
public MapBathConverter(final Access access, final CSV csv) throws IOException, CadiException {
map = new TreeMap<>();
@@ -110,7 +110,7 @@ public class MapBathConverter {
}
});
}
-
+
private static String idFromBasic(String bath, Holder<String> hpass) throws IOException, CadiException {
if(bath.startsWith(BASIC)) {
String cred = Symm.base64noSplit.decode(bath.substring(6));
@@ -128,8 +128,8 @@ public class MapBathConverter {
}
/**
- * use to instantiate entries
- *
+ * use to instantiate entries
+ *
* @return
*/
public Map<String,String> map() {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapPermConverter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapPermConverter.java
index 7953e076..24c7d290 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapPermConverter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapPermConverter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,7 +30,7 @@ public class MapPermConverter implements PermConverter {
/**
* Create with colon separated name value pairs
* i.e. teAdmin=com.att.myNS.myPerm|*|*:teUser=...
- *
+ *
* @param value
*/
public MapPermConverter() {
@@ -38,8 +38,8 @@ public class MapPermConverter implements PermConverter {
}
/**
- * use to instantiate entries
- *
+ * use to instantiate entries
+ *
* @return
*/
public Map<String,String> map() {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/PermConverter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/PermConverter.java
index dfd0f64b..e074a7fe 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/PermConverter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/PermConverter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,7 +23,7 @@ package org.onap.aaf.cadi.filter;
/**
* Convert a simplistic, single string Permission into an Enterprise Scoped Perm
- *
+ *
* @author Jonathan
*
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/RolesAllowed.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/RolesAllowed.java
index ac61a5c6..c27519fb 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/RolesAllowed.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/RolesAllowed.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,16 +20,16 @@
*/
/**
- * RolesAllowed
- *
+ * RolesAllowed
+ *
* @author Jonathan
- *
+ *
* Similar to Java EE's Spec from Annotations 1.1, 2.8
- *
+ *
* That Spec, however, was geared towards being able to route calls to Methods on Objects, and thus needed a more refined
* sense of permissions hierarchy. The same mechanism, however, can easily be achieved on single Servlet/Handlers in
* POJOs like Jetty by simply adding the Roles Allowed in a similar Annotation
- *
+ *
*/
package org.onap.aaf.cadi.filter;
import static java.lang.annotation.ElementType.TYPE;
@@ -39,9 +39,9 @@ import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
- * JASPI Style Annotation of RolesAllowed when the coding style is desired but actually including all
+ * JASPI Style Annotation of RolesAllowed when the coding style is desired but actually including all
* JEE jars is not. If using actual JASPI, use official @interface classes, not this one...
- *
+ *
* @author Jonathan
*/
@Target({TYPE})
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/ServletImpl.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/ServletImpl.java
index 5386eb2d..33bc29de 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/ServletImpl.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/ServletImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,16 +20,16 @@
*/
/**
- * RolesAllowed
- *
+ * RolesAllowed
+ *
* @author Jonathan
- *
+ *
* Similar to Java EE's Spec from Annotations 1.1, 2.8
- *
+ *
* That Spec, however, was geared towards being able to route calls to Methods on Objects, and thus needed a more refined
* sense of permissions hierarchy. The same mechanism, however, can easily be achieved on single Servlet/Handlers in
* POJOs like Jetty by simply adding the Roles Allowed in a similar Annotation
- *
+ *
*/
package org.onap.aaf.cadi.filter;
import static java.lang.annotation.ElementType.TYPE;
@@ -41,7 +41,7 @@ import java.lang.annotation.Target;
import javax.servlet.Servlet;
/**
- *
+ *
* @author Jonathan
*/
@Target({TYPE})
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/SideChain.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/SideChain.java
index 18e76b96..0f69b5b0 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/SideChain.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/SideChain.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,21 +33,21 @@ import javax.xml.ws.Holder;
/**
* Add various Filters by CADI Property not in the official Chain
- *
+ *
* @author Instrumental(Jonathan)
*
*/
public class SideChain {
private List<Filter> sideChain;
-
+
public SideChain() {
sideChain = new ArrayList<Filter>();
}
-
+
public void add(Filter f) {
sideChain.add(f);
}
-
+
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)throws IOException, ServletException {
final Holder<Boolean> hbool = new Holder<Boolean>(Boolean.TRUE);
FilterChain truth = new FilterChain() {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/ConfigPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/ConfigPrincipal.java
index a41c5eb7..56ba80a7 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/ConfigPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/ConfigPrincipal.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,7 +47,7 @@ public class ConfigPrincipal implements Principal, GetCred {
public String getName() {
return name;
}
-
+
public byte[] getCred() {
return cred;
}
@@ -55,14 +55,14 @@ public class ConfigPrincipal implements Principal, GetCred {
public String toString() {
return name;
}
-
+
public String getAsBasicAuthHeader() throws IOException {
if (content ==null) {
String s = name + ':' + new String(cred);
- content = "Basic " + Symm.base64.encode(s);
+ content = "Basic " + Symm.base64.encode(s);
} else if (!content.startsWith("Basic ")) { // content is the saved password from construction
String s = name + ':' + content;
- content = "Basic " + Symm.base64.encode(s);
+ content = "Basic " + Symm.base64.encode(s);
}
return content;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/EpiLur.java b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/EpiLur.java
index 5443dec2..3504290b 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/EpiLur.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/EpiLur.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,25 +32,25 @@ import org.onap.aaf.cadi.Permission;
/**
* EpiLUR
- *
+ *
* Short for "Epic LUR". Be able to run through a series of LURs to obtain the validation needed.
- *
- * The pun is better for the other pattern... "TAF" (aka EpiTaf), but it's still the larger picture of
+ *
+ * The pun is better for the other pattern... "TAF" (aka EpiTaf), but it's still the larger picture of
* LURs that will be accomplished.
- *
+ *
* FYI, the reason we separate LURs, rather than combine, is that Various User Repository Resources have
* different Caching requirements. For instance, the Local User Repo (with stand alone names), never expire, but might be
- * refreshed with a change in Configuration File, while the Remote Service based LURs will need to expire at prescribed intervals
- *
+ * refreshed with a change in Configuration File, while the Remote Service based LURs will need to expire at prescribed intervals
+ *
* @author Jonathan
*
*/
public final class EpiLur implements Lur {
private final Lur[] lurs;
-
+
/**
* EpiLur constructor
- *
+ *
* Construct the EpiLur from variable TAF parameters
* @param lurs
* @throws CadiException
@@ -86,7 +86,7 @@ public final class EpiLur implements Lur {
}
/**
- * Return the first Lur (if any) which also implements UserPass
+ * Return the first Lur (if any) which also implements UserPass
* @return
*/
public CredVal getUserPassImpl() {
@@ -102,7 +102,7 @@ public final class EpiLur implements Lur {
public boolean handlesExclusively(Permission ... pond) {
return false;
}
-
+
/**
* Get Lur for index. Returns null if out of range
* @param idx
@@ -131,7 +131,7 @@ public final class EpiLur implements Lur {
}
}
}
-
+
public Lur subLur(Class<? extends Lur> cls ) {
for (Lur l : lurs) {
if (l.getClass().isAssignableFrom(cls)) {
@@ -155,7 +155,7 @@ public final class EpiLur implements Lur {
lur.clear(p, report);
}
}
-
+
public String toString() {
StringBuilder sb = new StringBuilder();
for (Lur lur : lurs) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalLur.java b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalLur.java
index f8fa02e5..d6db6f4d 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalLur.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalLur.java
@@ -148,7 +148,7 @@ public final class LocalLur extends AbsUserCache<LocalPermission> implements Lur
public Permission createPerm(String p) {
return new LocalPermission(p);
}
-
+
private void parseUserProperties(String userProperties) throws IOException {
// For each User name...
for (String userProperty : userProperties.trim().split(SEMI)) {
@@ -179,7 +179,7 @@ public final class LocalLur extends AbsUserCache<LocalPermission> implements Lur
}
}
-
+
private void parseGroupProperties(String groupProperties) throws IOException {
// For each Group name...
for (String group : groupProperties.trim().split(SEMI)) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalPermission.java b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalPermission.java
index ee7bab9c..64cb7550 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalPermission.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalPermission.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,11 +25,11 @@ import org.onap.aaf.cadi.Permission;
public class LocalPermission implements Permission {
private String key;
-
+
public LocalPermission(String role) {
this.key = role;
}
-
+
public String getKey() {
return key;
}
@@ -45,6 +45,6 @@ public class LocalPermission implements Permission {
public String permType() {
return "LOCAL";
}
-
-
+
+
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/NullLur.java b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/NullLur.java
index fe9bbd30..c8ff2747 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/NullLur.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/NullLur.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -80,7 +80,7 @@ public class NullLur implements Lur {
report.append(NullLur.class.getSimpleName());
report.append('\n');
}
-
+
public String toString() {
return NullLur.class.getSimpleName() + '\n';
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java
index 746e67d8..8846f5f6 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -66,7 +66,7 @@ public class BasicPrincipal extends BearerPrincipal implements GetCred {
name = name + '@' + defaultDomain;
}
}
-
+
public BasicPrincipal(BasicCred bc, String domain) {
name = bc.getUser();
cred = bc.getCred();
@@ -76,7 +76,7 @@ public class BasicPrincipal extends BearerPrincipal implements GetCred {
private class BasicOS extends OutputStream {
private boolean first = true;
private ByteArrayOutputStream baos;
-
+
public BasicOS(int size) {
baos = new ByteArrayOutputStream(size);
}
@@ -86,33 +86,33 @@ public class BasicPrincipal extends BearerPrincipal implements GetCred {
if (b==':' && first) {
first = false;
name = new String(baos.toByteArray());
- baos.reset(); //
+ baos.reset(); //
} else {
baos.write(b);
}
}
-
+
private byte[] toCred() {
return baos.toByteArray();
}
}
-
+
public String getName() {
return name;
}
-
+
public String getShortName() {
return shortName;
}
-
+
public String getDomain() {
return domain;
}
-
+
public byte[] getCred() {
return cred;
}
-
+
public long created() {
return created;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BearerPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BearerPrincipal.java
index 6fdcdc0d..4930796c 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BearerPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BearerPrincipal.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/CachedBasicPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/CachedBasicPrincipal.java
index 4a6e4cda..1a733e04 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/CachedBasicPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/CachedBasicPrincipal.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,7 +29,7 @@ import org.onap.aaf.cadi.taf.HttpTaf;
/**
* Cached Principals need to be able to revalidate in the Background
- *
+ *
* @author Jonathan
*
*/
@@ -44,7 +44,7 @@ public class CachedBasicPrincipal extends BasicPrincipal implements CachedPrinci
this.timeToLive = timeToLive;
expires = System.currentTimeMillis()+timeToLive;
}
-
+
public CachedBasicPrincipal(HttpTaf creator, String content, String domain, long timeToLive) throws IOException {
super(content, domain);
this.creator = creator;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/Kind.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/Kind.java
index 20f22846..368908a8 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/Kind.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/Kind.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,8 +29,8 @@ public class Kind {
public static final char AAF_OAUTH='A';
public static final char BASIC_AUTH = 'B';
public static final char UNKNOWN = 'U';
-
-
+
+
public static char getKind(final Principal principal) {
Principal check;
if (principal instanceof TrustPrincipal) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/OAuth2FormPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/OAuth2FormPrincipal.java
index 01326054..5a7a7761 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/OAuth2FormPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/OAuth2FormPrincipal.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,20 +24,20 @@ package org.onap.aaf.cadi.principal;
public class OAuth2FormPrincipal extends TaggedPrincipal {
private final String username;
private final String client_id;
-
+
/*
* Note: client_id and username might be the same, if only authenticating the Client_ID
*/
public OAuth2FormPrincipal(final String client_id, final String username) {
this.username = username;
- this.client_id = client_id;
+ this.client_id = client_id;
}
-
+
@Override
public String getName() {
return username;
}
-
+
public String client_id() {
return client_id;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TaggedPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TaggedPrincipal.java
index 7bb4ff52..8aaad117 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TaggedPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TaggedPrincipal.java
@@ -39,9 +39,9 @@ public abstract class TaggedPrincipal implements Principal {
public interface TagLookup {
public String lookup() throws CadiException;
}
-
+
private TagLookup tagLookup;
-
+
public void setTagLookup(TagLookup tl) {
tagLookup = tl;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TrustPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TrustPrincipal.java
index 7e92aaca..352b4e1d 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TrustPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TrustPrincipal.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,7 +29,7 @@ public class TrustPrincipal extends BearerPrincipal implements UserChain {
private final String name;
private final Principal original;
private String userChain;
-
+
public TrustPrincipal(final Principal actual, final String asName) {
this.original = actual;
name = asName.trim();
@@ -42,17 +42,17 @@ public class TrustPrincipal extends BearerPrincipal implements UserChain {
userChain = actual.getClass().getSimpleName();
}
}
-
+
@Override
public String getName() {
return name;
}
-
+
@Override
public String userChain() {
return userChain;
}
-
+
public Principal original() {
return original;
}
@@ -66,5 +66,5 @@ public class TrustPrincipal extends BearerPrincipal implements UserChain {
public String personalName() {
return original.getName() + '[' + userChain + ']';
}
-
+
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/UnAuthPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/UnAuthPrincipal.java
index f0cacd8d..872f4aa4 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/UnAuthPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/UnAuthPrincipal.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@ import java.security.Principal;
public class UnAuthPrincipal implements Principal {
private String name;
-
+
public UnAuthPrincipal(final String name) {
this.name = name;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/X509Principal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/X509Principal.java
index 0348cd1f..f5303584 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/X509Principal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/X509Principal.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,7 +34,7 @@ public class X509Principal extends BearerPrincipal implements GetCred {
private final X509Certificate cert;
private final String name;
private byte[] content;
- private BasicHttpTaf bht;
+ private BasicHttpTaf bht;
public X509Principal(String identity, X509Certificate cert) {
name = identity;
@@ -71,7 +71,7 @@ public class X509Principal extends BearerPrincipal implements GetCred {
name = _name;
this.bht = bht;
}
-
+
public String getAsHeader() throws IOException {
try {
if (content==null) {
@@ -82,7 +82,7 @@ public class X509Principal extends BearerPrincipal implements GetCred {
}
return "X509 " + content;
}
-
+
public String toString() {
return "X509 Authentication for " + name;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/AbsTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/AbsTafResp.java
index f420f41f..c8f2a629 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/AbsTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/AbsTafResp.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,9 +27,9 @@ import org.onap.aaf.cadi.util.Timing;
/**
* AbsTafResp
- *
+ *
* Base class for TafResp (TAF Response Objects)
- *
+ *
* @author Jonathan
*
*/
@@ -45,14 +45,14 @@ public abstract class AbsTafResp implements TafResp {
/**
* AbsTafResp
- *
+ *
* Set and hold
* Description (for logging)
* Principal (as created by derived class)
* Access (for access to underlying container, i.e. for Logging, auditing, ClassLoaders, etc)
- *
+ *
* @param access
- * @param tafname
+ * @param tafname
* @param principal
* @param description
*/
@@ -63,17 +63,17 @@ public abstract class AbsTafResp implements TafResp {
this.target = principal==null?"unknown":principal.getName();
this.desc = description;
}
-
+
/**
* AbsTafResp
- *
+ *
* Set and hold
* Description (for logging)
* Principal (as created by derived class)
* Access (for access to underlying container, i.e. for Logging, auditing, ClassLoaders, etc)
- *
+ *
* @param access
- * @param tafname
+ * @param tafname
* @param principal
* @param description
*/
@@ -87,7 +87,7 @@ public abstract class AbsTafResp implements TafResp {
/**
* isValid()
- *
+ *
* Respond in the affirmative if the TAF was able to Authenticate
*/
public boolean isValid() {
@@ -96,8 +96,8 @@ public abstract class AbsTafResp implements TafResp {
/**
* desc()
- *
- * Respond with description of response as given by the TAF
+ *
+ * Respond with description of response as given by the TAF
*/
public String desc() {
return desc;
@@ -105,11 +105,11 @@ public abstract class AbsTafResp implements TafResp {
/**
* isAuthenticated()
- *
+ *
* Respond with the TAF's code of whether Authenticated, or suggested next steps
* default is either IS_AUTHENTICATED, or TRY_ANOTHER_TAF. The TAF can overload
* and suggest others, such as "NO_FURTHER_PROCESSING", if it can detect that this
- * is some sort of security breach (i.e. Denial of Service)
+ * is some sort of security breach (i.e. Denial of Service)
*/
public RESP isAuthenticated() {
return principal==null?RESP.TRY_ANOTHER_TAF:RESP.IS_AUTHENTICATED;
@@ -117,9 +117,9 @@ public abstract class AbsTafResp implements TafResp {
/**
* getPrincipal()
- *
- * Return the principal created by the TAF based on Authentication.
- *
+ *
+ * Return the principal created by the TAF based on Authentication.
+ *
* Returns "null" if Authentication failed (no principal)
*/
public TaggedPrincipal getPrincipal() {
@@ -133,10 +133,10 @@ public abstract class AbsTafResp implements TafResp {
public String getTarget() {
return target;
}
-
+
/**
* getAccess()
- *
+ *
* Get the Access object from the TAF, so that appropriate Logging, etc can be coordinated.
*/
public Access getAccess() {
@@ -154,7 +154,7 @@ public abstract class AbsTafResp implements TafResp {
public float timing() {
return timing;
}
-
+
@Override
public void timing(final long start) {
timing = Timing.millis(start);
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/EpiTaf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/EpiTaf.java
index d2cbf3fa..683b10ba 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/EpiTaf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/EpiTaf.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,21 +26,21 @@ import org.onap.aaf.cadi.Taf;
/**
* EpiTAF
- *
+ *
* Short for "Epic TAF". Be able to run through a series of TAFs to obtain the validation needed.
- *
+ *
* OK, the name could probably be better as "Tafs", like it was originally, but the pun was too
* irresistible for this author to pass up.
- *
+ *
* @author Jonathan
*
*/
public class EpiTaf implements Taf {
private Taf[] tafs;
-
+
/**
* EpiTaf constructor
- *
+ *
* Construct the EpiTaf from variable TAF parameters
* @param tafs
* @throws CadiException
@@ -52,13 +52,13 @@ public class EpiTaf implements Taf {
/**
* validate
- *
- * Respond with the first TAF to authenticate user based on variable info and "LifeForm" (is it
+ *
+ * Respond with the first TAF to authenticate user based on variable info and "LifeForm" (is it
* a human behind an interface, or a server behind a protocol).
- *
+ *
* If there is no TAF that can authenticate, respond with the first TAF that suggests it can
* establish an Authentication conversation (TRY_AUTHENTICATING).
- *
+ *
* If no TAF declares either, respond with NullTafResp (which denies all questions)
*/
public TafResp validate(LifeForm reading, String... info) {
@@ -76,7 +76,7 @@ public class EpiTaf implements Taf {
}
}
- // No TAFs configured, at this point. It is safer at this point to be "not validated",
+ // No TAFs configured, at this point. It is safer at this point to be "not validated",
// rather than "let it go"
return firstTryAuth == null?NullTafResp.singleton():firstTryAuth;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpEpiTaf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpEpiTaf.java
index 6334164e..f8eb089e 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpEpiTaf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpEpiTaf.java
@@ -181,7 +181,7 @@ public class HttpEpiTaf implements HttpTaf {
}
return Resp.NOT_MINE;
}
-
+
private void addToLog(List<TafResp> log, final TafResp tresp, final long start) {
if (log == null) {
return;
@@ -189,7 +189,7 @@ public class HttpEpiTaf implements HttpTaf {
tresp.timing(start);
log.add(tresp);
}
-
+
private void printLog(List<TafResp> log) {
if (log == null) {
return;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpTaf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpTaf.java
index 77976ce2..76938036 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpTaf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpTaf.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,31 +28,31 @@ import org.onap.aaf.cadi.CachedPrincipal;
import org.onap.aaf.cadi.Taf.LifeForm;
/**
- * A TAF which is in a specific HTTP environment in which the engine implements
+ * A TAF which is in a specific HTTP environment in which the engine implements
* javax Servlet.
- *
+ *
* Using the Http Request and Response interfaces takes the effort out of implementing in almost any kind of
* HTTP Container or Engine.
- *
+ *
* @author Jonathan
*
*/
public interface HttpTaf {
/**
* validate
- *
+ *
* Validate the Request, and respond with created TafResp object.
- *
+ *
* @param reading
* @param req
* @param resp
* @return
*/
public TafResp validate(LifeForm reading, HttpServletRequest req, HttpServletResponse resp);
-
+
/**
* Re-Validate Credential
- *
+ *
* @param prin
* @return
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/LoginPageTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/LoginPageTafResp.java
index d64fbe0d..541fa395 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/LoginPageTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/LoginPageTafResp.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,15 +47,15 @@ public class LoginPageTafResp extends AbsTafResp {
httpResp.sendRedirect(loginPageURL);
return RESP.HTTP_REDIRECT_INVOKED;
}
-
+
@Override
public RESP isAuthenticated() {
return RESP.TRY_AUTHENTICATING;
}
-
+
public static TafResp create(Access access, Locator<URI> locator, final HttpServletResponse resp, List<Redirectable> redirectables) {
if (locator == null) {
- if (!redirectables.isEmpty()) {
+ if (!redirectables.isEmpty()) {
access.log(Level.DEBUG,"LoginPage Locator is not configured. Taking first Redirectable Taf");
return redirectables.get(0);
}
@@ -91,7 +91,7 @@ public class LoginPageTafResp extends AbsTafResp {
return NullTafResp.singleton();
}
-
+
@Override
public String taf() {
return "LoginPage";
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTaf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTaf.java
index 7e834794..5b31e103 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTaf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTaf.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,7 +32,7 @@ import org.onap.aaf.cadi.CachedPrincipal.Resp;
/**
* This TAF is set at the very beginning of Filters and Valves so that if any configuration issues hit while
* starting, the default behavior is to shut down traffic rather than leaving an open hole
- *
+ *
* @author Jonathan
*
*/
@@ -41,8 +41,8 @@ public class NullTaf implements Taf, HttpTaf {
public NullTaf() {}
/**
- * validate
- *
+ * validate
+ *
* Always Respond with a NullTafResp, which declares it is unauthenticated, and unauthorized
*/
public TafResp validate(LifeForm reading, String... info) {
@@ -50,8 +50,8 @@ public class NullTaf implements Taf, HttpTaf {
}
/**
- * validate
- *
+ * validate
+ *
* Always Respond with a NullTafResp, which declares it is unauthenticated, and unauthorized
*/
public TafResp validate(LifeForm reading, HttpServletRequest req, HttpServletResponse resp) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTafResp.java
index b3b7fb59..3e77cfac 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTafResp.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,25 +33,25 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
*/
class NullTafResp implements TafResp {
private NullTafResp(){}
-
+
private static TafResp singleton = new NullTafResp();
-
+
public static TafResp singleton() {
return singleton;
}
-
+
public boolean isValid() {
return false;
}
-
+
public RESP isAuthenticated() {
return RESP.NO_FURTHER_PROCESSING;
}
-
+
public String desc() {
return "All Authentication denied";
}
-
+
public RESP authenticate() throws IOException {
return RESP.NO_FURTHER_PROCESSING;
}
@@ -87,7 +87,7 @@ class NullTafResp implements TafResp {
@Override
public void timing(long start) {
}
-
+
@Override
public String taf() {
return "NULL";
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/PuntTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/PuntTafResp.java
index 6bb57d36..aa5f34ca 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/PuntTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/PuntTafResp.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -42,19 +42,19 @@ public class PuntTafResp implements TafResp {
this.name = name;
desc = "Not processing this transaction: " + explanation;
}
-
+
public boolean isValid() {
return false;
}
-
+
public RESP isAuthenticated() {
return RESP.TRY_ANOTHER_TAF;
}
-
+
public String desc() {
return desc;
}
-
+
public RESP authenticate() throws IOException {
return RESP.TRY_ANOTHER_TAF;
}
@@ -88,7 +88,7 @@ public class PuntTafResp implements TafResp {
public void timing(long start) {
timing = Timing.millis(start);
}
-
+
@Override
public String taf() {
return name;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/Redirectable.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/Redirectable.java
index 47c262b0..37b531c9 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/Redirectable.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/Redirectable.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TafResp.java
index 6850a372..c1563f59 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TafResp.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,38 +29,38 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
/**
* Response from Taf objects, which inform users what has happened and/or what should be done
- *
+ *
* @author Jonathan
*
*/
public interface TafResp {
public static enum RESP {
- IS_AUTHENTICATED,
- NO_FURTHER_PROCESSING,
- TRY_AUTHENTICATING,
+ IS_AUTHENTICATED,
+ NO_FURTHER_PROCESSING,
+ TRY_AUTHENTICATING,
TRY_ANOTHER_TAF,
- FAIL,
- // A note was made to avoid the response REDIRECT. However, I have deemed that it is
+ FAIL,
+ // A note was made to avoid the response REDIRECT. However, I have deemed that it is
// unavoidable when the underlying TAF did do a REDIRECT, because it requires a HTTP
// Service code to exit without modifying the Response any further.
- // Therefore, I have changed this to indicate what HAS happened, with should accommodate
+ // Therefore, I have changed this to indicate what HAS happened, with should accommodate
// both positions. Jonathan 10/18/2012
// public static final int HTTP_REDIRECT_INVOKED = 11;
HTTP_REDIRECT_INVOKED,
HAS_PROCESSED};
-
+
/**
* Basic success check
* @return
*/
public boolean isValid();
-
+
/**
* String description of what has occurred (for logging/exceptions)
* @return
*/
public String desc();
-
+
/**
* Check Response
* @return
@@ -69,10 +69,10 @@ public interface TafResp {
/**
* Authenticate, returning FAIL or Other Valid indication
- *
+ *
* HTTP implementations should watch for "HTTP_REDIRECT_INVOKED", and end the HTTP call appropriately.
* @return
- * @throws CadiException
+ * @throws CadiException
*/
public RESP authenticate() throws IOException;
@@ -81,7 +81,7 @@ public interface TafResp {
* @return
*/
public TaggedPrincipal getPrincipal();
-
+
/** Target - when Authentication Fails, need to know what ID was being attempted
* @return
*/
@@ -91,12 +91,12 @@ public interface TafResp {
* get the Access object which created this object, allowing the responder to appropriate Log, etc
*/
public Access getAccess();
-
+
/**
* Be able to check if part of a Failed attempt
*/
public boolean isFailedAttempt();
-
+
/**
* report how long this took
* @return
@@ -108,7 +108,7 @@ public interface TafResp {
* @param start
*/
void timing(long start);
-
+
/**
* Support Taf Name
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustNotTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustNotTafResp.java
index dee0ba07..290d5f03 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustNotTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustNotTafResp.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,12 +31,12 @@ public class TrustNotTafResp implements TafResp {
private final TafResp delegate;
private final String desc;
private float timing;
-
+
public TrustNotTafResp(final TafResp delegate, final String desc) {
this.delegate = delegate;
this.desc = desc;
}
-
+
@Override
public boolean isValid() {
return false;
@@ -88,12 +88,12 @@ public class TrustNotTafResp implements TafResp {
public void timing(long start) {
timing = Timing.millis(start);
}
-
+
@Override
public String toString() {
return desc();
}
-
+
@Override
public String taf() {
return "TrustNot";
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustTafResp.java
index 2701c27a..5a85ebfd 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustTafResp.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,13 +32,13 @@ public class TrustTafResp implements TafResp {
private final TaggedPrincipal principal;
private final String desc;
private float timing;
-
+
public TrustTafResp(final TafResp delegate, final TaggedPrincipal principal, final String desc) {
this.delegate = delegate;
this.principal = principal;
this.desc = desc + ' ' + delegate.desc();
}
-
+
@Override
public boolean isValid() {
return delegate.isValid();
@@ -90,11 +90,11 @@ public class TrustTafResp implements TafResp {
public void timing(long start) {
timing = Timing.millis(start);
}
-
+
public String toString() {
return principal.getName() + " by trust of " + desc();
}
-
+
@Override
public String taf() {
return "Trust";
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTaf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTaf.java
index 93360761..b3cf4a7d 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTaf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTaf.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -51,15 +51,15 @@ import org.onap.aaf.cadi.util.CSV;
/**
* BasicHttpTaf
- *
- * This TAF implements the "Basic Auth" protocol.
- *
- * WARNING! It is true for any implementation of "Basic Auth" that the password is passed unencrypted.
- * This is because the expectation, when designed years ago, was that it would only be used in
+ *
+ * This TAF implements the "Basic Auth" protocol.
+ *
+ * WARNING! It is true for any implementation of "Basic Auth" that the password is passed unencrypted.
+ * This is because the expectation, when designed years ago, was that it would only be used in
* conjunction with SSL (https). It is common, however, for users to ignore this on the assumption that
* their internal network is secure, or just ignorance. Therefore, a WARNING will be printed
* when the HTTP Channel is not encrypted (unless explicitly turned off).
- *
+ *
* @author Jonathan
*
*/
@@ -71,7 +71,7 @@ public class BasicHttpTaf implements HttpTaf {
private boolean warn;
private long timeToLive;
private MapBathConverter mapIds;
-
+
public BasicHttpTaf(Access access, CredVal rbac, String realm, long timeToLive, boolean turnOnWarning) {
this.access = access;
this.realm = realm;
@@ -93,9 +93,9 @@ public class BasicHttpTaf implements HttpTaf {
public void add(final CredValDomain cvd) {
rbacs.put(cvd.domain(), cvd);
}
-
+
/**
- * Note: BasicHttp works for either Carbon Based (Humans) or Silicon Based (machine) Lifeforms.
+ * Note: BasicHttp works for either Carbon Based (Humans) or Silicon Based (machine) Lifeforms.
* @see Taf
*/
public TafResp validate(Taf.LifeForm reading, HttpServletRequest req, HttpServletResponse resp) {
@@ -107,20 +107,20 @@ public class BasicHttpTaf implements HttpTaf {
return DenialOfServiceTaf.respDenyID(access,bc.getUser());
}
CachedBasicPrincipal bp = new CachedBasicPrincipal(this,bc,realm,timeToLive);
-
+
// Be able to do Organizational specific lookups by Domain
CredVal cv = rbacs.get(bp.getDomain());
if (cv==null) {
cv = rbac;
}
-
- // ONLY FOR Last Ditch DEBUGGING...
+
+ // ONLY FOR Last Ditch DEBUGGING...
// access.log(Level.WARN,bp.getName() + ":" + new String(bp.getCred()));
if (cv.validate(bp.getName(),Type.PASSWORD,bp.getCred(),req)) {
return new BasicHttpTafResp(access,bp,bp.getName()+" authenticated by password",RESP.IS_AUTHENTICATED,resp,realm,false);
} else {
//TODO may need timed retries in a given time period
- return new BasicHttpTafResp(access,bc.getUser(),buildMsg(bp,req,"user/pass combo invalid for ",bc.getUser(),"from",req.getRemoteAddr()),
+ return new BasicHttpTafResp(access,bc.getUser(),buildMsg(bp,req,"user/pass combo invalid for ",bc.getUser(),"from",req.getRemoteAddr()),
RESP.TRY_AUTHENTICATING,resp,realm,true);
}
}
@@ -142,20 +142,20 @@ public class BasicHttpTaf implements HttpTaf {
if (DenialOfServiceTaf.isDeniedID(ba.getName())!=null) {
return DenialOfServiceTaf.respDenyID(access,ba.getName());
}
-
+
final int at = ba.getName().indexOf('@');
CredVal cv = rbacs.get(ba.getName().substring(at+1));
- if (cv==null) {
+ if (cv==null) {
cv = rbac; // default
}
- // ONLY FOR Last Ditch DEBUGGING...
+ // ONLY FOR Last Ditch DEBUGGING...
// access.log(Level.WARN,ba.getName() + ":" + new String(ba.getCred()));
if (cv.validate(ba.getName(), Type.PASSWORD, ba.getCred(), req)) {
return new BasicHttpTafResp(access,ba, ba.getName()+" authenticated by BasicAuth password",RESP.IS_AUTHENTICATED,resp,realm,false);
} else {
//TODO may need timed retries in a given time period
- return new BasicHttpTafResp(access,target,buildMsg(ba,req,"user/pass combo invalid"),
+ return new BasicHttpTafResp(access,target,buildMsg(ba,req,"user/pass combo invalid"),
RESP.TRY_AUTHENTICATING,resp,realm,true);
}
} catch (IOException e) {
@@ -166,7 +166,7 @@ public class BasicHttpTaf implements HttpTaf {
}
return new BasicHttpTafResp(access,target,"Requesting HTTP Basic Authorization",RESP.TRY_AUTHENTICATING,resp,realm,false);
}
-
+
protected String buildMsg(Principal pr, HttpServletRequest req, Object ... msg) {
StringBuilder sb = new StringBuilder();
if (pr!=null) {
@@ -187,7 +187,7 @@ public class BasicHttpTaf implements HttpTaf {
}
return sb.toString();
}
-
+
public void addCredVal(final String realm, final CredVal cv) {
rbacs.put(realm, cv);
}
@@ -199,7 +199,7 @@ public class BasicHttpTaf implements HttpTaf {
}
return cv;
}
-
+
@Override
public Resp revalidate(CachedPrincipal prin, Object state) {
if (prin instanceof BasicPrincipal) {
@@ -211,7 +211,7 @@ public class BasicHttpTaf implements HttpTaf {
}
return Resp.NOT_MINE;
}
-
+
public String toString() {
return "Basic Auth enabled on realm: " + realm;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTafResp.java
index e2174493..36da354b 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTafResp.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,7 +36,7 @@ public class BasicHttpTafResp extends AbsTafResp implements TafResp {
private String realm;
private RESP status;
private final boolean wasFailed;
-
+
public BasicHttpTafResp(Access access, TaggedPrincipal principal, String description, RESP status, HttpServletResponse resp, String realm, boolean wasFailed) {
super(access, tafName, principal, description);
httpResp = resp;
@@ -54,7 +54,7 @@ public class BasicHttpTafResp extends AbsTafResp implements TafResp {
}
public RESP authenticate() throws IOException {
- httpResp.setStatus(401); // Unauthorized
+ httpResp.setStatus(401); // Unauthorized
httpResp.setHeader("WWW-Authenticate", "Basic realm=\""+realm+'"');
return RESP.HTTP_REDIRECT_INVOKED;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/CertIdentity.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/CertIdentity.java
index f597159e..18c0049f 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/CertIdentity.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/CertIdentity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,16 +31,16 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
public interface CertIdentity {
/**
* identity from X509Certificate Object and/or certBytes
- *
+ *
* If you have both, include them. If you only have one, leave the other null, and it will be generated if needed
- *
+ *
* The Request is there to obtain Header or Attribute info of ultimate user
- *
+ *
* @param req
* @param cert
* @param certBytes
* @return
- * @throws CertificateException
+ * @throws CertificateException
*/
public TaggedPrincipal identity(HttpServletRequest req, X509Certificate cert, byte[] certBytes) throws CertificateException;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509HttpTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509HttpTafResp.java
index d51cc86a..46a01d3e 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509HttpTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509HttpTafResp.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,7 +32,7 @@ public class X509HttpTafResp extends AbsTafResp implements TafResp {
private static final String tafName = X509Taf.class.getSimpleName();
private RESP status;
-
+
public X509HttpTafResp(Access access, TaggedPrincipal principal, String description, RESP status) {
super(access, tafName, principal, description);
this.status = status;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509Taf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509Taf.java
index 914c57b5..a06fb8e1 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509Taf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509Taf.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -77,7 +77,7 @@ public class X509Taf implements HttpTaf {
throw new RuntimeException("X.509 and SHA-256 are required for X509Taf",e);
}
}
-
+
public X509Taf(Access access, Lur lur, CertIdentity ... cis) throws CertificateException, NoSuchAlgorithmException, CadiException {
this.access = access;
env = access.getProperty(Config.AAF_ENV,null);
@@ -103,7 +103,7 @@ public class X509Taf implements HttpTaf {
} catch (Exception e) {
certIdents = cis;
}
-
+
si = new SecurityInfo(access);
}
@@ -141,7 +141,7 @@ public class X509Taf implements HttpTaf {
int end = 1;
int comma;
int length = subject.length();
-
+
compare:
while(start<length) {
while(Character.isWhitespace(subject.charAt(start))) {
@@ -165,9 +165,9 @@ public class X509Taf implements HttpTaf {
int at = subject.indexOf('@', start);
if(at<end && at>=0) {
String[] sa = Split.splitTrim(':', subject, start+3,end+1);
- if (sa.length==1 || (sa.length>1 && env!=null && env.equals(sa[1]))) { // Check Environment
- return new X509HttpTafResp(access,
- new X509Principal(sa[0], certarr[0],(byte[])null,bht),
+ if (sa.length==1 || (sa.length>1 && env!=null && env.equals(sa[1]))) { // Check Environment
+ return new X509HttpTafResp(access,
+ new X509Principal(sa[0], certarr[0],(byte[])null,bht),
"X509Taf validated " + sa[0] + (sa.length<2?"":" for aaf_env " + env ), RESP.IS_AUTHENTICATED);
} else {
access.printf(Level.DEBUG,"Certificate is not for environment '%s'",env);
@@ -184,7 +184,7 @@ public class X509Taf implements HttpTaf {
} else {
access.log(Level.DEBUG,"There is no client certificate on the transaction");
}
-
+
byte[] array = null;
byte[] certBytes = null;
@@ -213,30 +213,30 @@ public class X509Taf implements HttpTaf {
Symm.base64noSplit.decode(bais, baos, 5);
certBytes = baos.toByteArray();
cert = getCert(certBytes);
-
- /**
+
+ /**
* Identity from CERT if well know CA and specific encoded information
*/
// If found Identity doesn't work, try SignedStuff Protocol
// cert.checkValidity();
// cert.--- GET FINGERPRINT?
String stuff = req.getHeader("Signature");
- if (stuff==null)
+ if (stuff==null)
return new X509HttpTafResp(access, null, "Header entry 'Signature' required to validate One way X509 Certificate", RESP.TRY_ANOTHER_TAF);
- String data = req.getHeader("Data");
- // if (data==null)
+ String data = req.getHeader("Data");
+ // if (data==null)
// return new X509HttpTafResp(access, null, "No signed Data to validate with X509 Certificate", RESP.TRY_ANOTHER_TAF);
-
+
// Note: Data Pos shows is "<signatureType> <data>"
// int dataPos = (stuff.indexOf(' ')); // determine what is Algorithm
- // Get Signature
+ // Get Signature
bais = new ByteArrayInputStream(stuff.getBytes());
baos = new ByteArrayOutputStream(stuff.length());
Symm.base64noSplit.decode(bais, baos);
array = baos.toByteArray();
// Signature sig = Signature.getInstance(stuff.substring(0, dataPos)); // get Algorithm from first part of Signature
-
- Signature sig = Signature.getInstance(cert.getSigAlgName());
+
+ Signature sig = Signature.getInstance(cert.getSigAlgName());
sig.initVerify(cert.getPublicKey());
sig.update(data.getBytes());
if (!sig.verify(array)) {
@@ -254,16 +254,16 @@ public class X509Taf implements HttpTaf {
if (cert==null) {
return new X509HttpTafResp(access, null, "No Certificate Info on Transaction", RESP.TRY_ANOTHER_TAF);
}
-
+
// A cert has been found, match Identify
TaggedPrincipal prin=null;
-
+
for (int i=0;prin==null && i<certIdents.length;++i) {
if ((prin=certIdents[i].identity(req, cert, certBytes))!=null) {
responseText = prin.getName() + " matches Certificate " + cert.getSubjectX500Principal().getName() + responseText;
}
}
-
+
// if Principal is found, check for "AS_USER" and whether this entity is trusted to declare
if (prin!=null) {
// Note: Tag for Certs is Fingerprint, but that takes computation... leaving off
@@ -275,9 +275,9 @@ public class X509Taf implements HttpTaf {
}
}
} catch (Exception e) {
- return new X509HttpTafResp(access, null, e.getMessage(), RESP.TRY_ANOTHER_TAF);
+ return new X509HttpTafResp(access, null, e.getMessage(), RESP.TRY_ANOTHER_TAF);
}
-
+
return new X509HttpTafResp(access, null, "Certificate cannot be used for authentication", RESP.TRY_ANOTHER_TAF);
}
@@ -289,7 +289,7 @@ public class X509Taf implements HttpTaf {
public void add(BasicHttpTaf bht) {
this.bht = bht;
}
-
+
public CredVal getCredVal(final String key) {
if (bht==null) {
return null;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTaf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTaf.java
index f083e5aa..1eadc1ae 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTaf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTaf.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,9 +52,9 @@ public class DenialOfServiceTaf implements HttpTaf {
private Access access;
private final TafResp puntNotDenied;
private static File dosIP, dosID;
-
+
/**
- *
+ *
* @param hostname
* @param prod
* @throws CadiException
@@ -84,7 +84,7 @@ public class DenialOfServiceTaf implements HttpTaf {
return respDenyIP(access,ip);
}
}
-
+
// Note: Can't process Principal, because this is the first TAF, and no Principal is created.
// Other TAFs use "isDenied()" on this Object to validate.
return puntNotDenied;
@@ -97,7 +97,7 @@ public class DenialOfServiceTaf implements HttpTaf {
}
/*
- * for use in Other TAFs, before they attempt backend validation of
+ * for use in Other TAFs, before they attempt backend validation of
*/
public static Counter isDeniedID(String identity) {
if (deniedID!=null) {
@@ -105,9 +105,9 @@ public class DenialOfServiceTaf implements HttpTaf {
}
return null;
}
-
+
/**
- *
+ *
*/
public static Counter isDeniedIP(String ipvX) {
if (deniedIP!=null) {
@@ -119,7 +119,7 @@ public class DenialOfServiceTaf implements HttpTaf {
/**
* Return of "True" means IP has been added.
* Return of "False" means IP already added.
- *
+ *
* @param ip
* @return
*/
@@ -138,7 +138,7 @@ public class DenialOfServiceTaf implements HttpTaf {
}
return rv;
}
-
+
private static void writeIP() {
if (dosIP!=null && deniedIP!=null) {
if (deniedIP.isEmpty()) {
@@ -162,7 +162,7 @@ public class DenialOfServiceTaf implements HttpTaf {
}
}
}
-
+
private static void readIP() {
if (dosIP!=null && dosIP.exists()) {
BufferedReader br;
@@ -190,7 +190,7 @@ public class DenialOfServiceTaf implements HttpTaf {
/**
* Return of "True" means IP has was removed.
* Return of "False" means IP wasn't being denied.
- *
+ *
* @param ip
* @return
*/
@@ -208,7 +208,7 @@ public class DenialOfServiceTaf implements HttpTaf {
/**
* Return of "True" means ID has been added.
* Return of "False" means ID already added.
- *
+ *
* @param ip
* @return
*/
@@ -262,7 +262,7 @@ public class DenialOfServiceTaf implements HttpTaf {
if (deniedID==null) {
deniedID=new HashMap<>();
}
-
+
String line;
while ((line=br.readLine())!=null) {
deniedID.put(line, new Counter(line));
@@ -279,12 +279,12 @@ public class DenialOfServiceTaf implements HttpTaf {
/**
* Return of "True" means ID has was removed.
* Return of "False" means ID wasn't being denied.
- *
+ *
* @param ip
* @return
*/
public static synchronized boolean removeDenyID(String id) {
- if (deniedID!=null && deniedID.remove(id)!=null) {
+ if (deniedID!=null && deniedID.remove(id)!=null) {
writeID();
if (deniedID.isEmpty()) {
deniedID=null;
@@ -294,7 +294,7 @@ public class DenialOfServiceTaf implements HttpTaf {
}
return false;
}
-
+
public List<String> report() {
int initSize = 0;
if (deniedIP!=null)initSize+=deniedIP.size();
@@ -312,24 +312,24 @@ public class DenialOfServiceTaf implements HttpTaf {
}
return al;
}
-
+
public static class Counter {
- private final String name;
+ private final String name;
private int count = 0;
private Date first;
private long last; // note, we use "last" as long, to avoid popping useless dates on Heap.
-
+
public Counter(String name) {
this.name = name;
first = null;
last = 0L;
count = 0;
}
-
+
public String getName() {
return name;
}
-
+
public int getCount() {
return count;
}
@@ -337,7 +337,7 @@ public class DenialOfServiceTaf implements HttpTaf {
public long getLast() {
return last;
}
-
+
/*
* Only allow Denial of ServiceTaf to increment
*/
@@ -348,12 +348,12 @@ public class DenialOfServiceTaf implements HttpTaf {
first = new Date(last);
}
}
-
+
public String toString() {
- if (count==0)
- return name + " is on the denied list, but has not attempted Access";
- else
- return
+ if (count==0)
+ return name + " is on the denied list, but has not attempted Access";
+ else
+ return
name +
" has been denied " +
count +
@@ -367,7 +367,7 @@ public class DenialOfServiceTaf implements HttpTaf {
public static TafResp respDenyID(Access access, String identity) {
return new DenialOfServiceTafResp(access, RESP.NO_FURTHER_PROCESSING, identity + " is on the Identity Denial list");
}
-
+
public static TafResp respDenyIP(Access access, String ip) {
return new DenialOfServiceTafResp(access, RESP.NO_FURTHER_PROCESSING, ip + " is on the IP Denial list");
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTafResp.java
index 2215a6f9..eea0d928 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTafResp.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,12 +41,12 @@ public class DenialOfServiceTafResp extends AbsTafResp {
public RESP isAuthenticated() {
return ect;
}
-
+
public RESP authenticate() throws IOException {
return ect;
}
-
+
@Override
public String taf() {
return "DOS";
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java
index 2c9bb8c4..476b2df1 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,7 +36,7 @@ import org.onap.aaf.cadi.CadiException;
/**
* Read CSV file for various purposes
- *
+ *
* @author Instrumental(Jonathan)
*
*/
@@ -46,26 +46,26 @@ public class CSV {
private boolean processAll;
private char delimiter = ',';
private boolean go;
-
+
public CSV(Access access, File file) {
this.access = access;
csv = file;
processAll = false;
go = true;
}
-
+
public CSV(Access access, String csvFilename) {
this.access = access;
csv = new File(csvFilename);
processAll = false;
go = true;
}
-
+
public CSV setDelimiter(char delimiter) {
this.delimiter = delimiter;
return this;
}
-
+
public String name() {
return csv.getName();
}
@@ -76,16 +76,16 @@ public class CSV {
}
/*
* Create your code to accept the List<String> row.
- *
+ *
* Your code may keep the List... CSV does not hold onto it.
- *
+ *
* @author Instrumental(Jonathan)
*
*/
public interface Visitor {
void visit(List<String> row) throws IOException, CadiException;
}
-
+
public void visit(Visitor visitor) throws IOException, CadiException {
BufferedReader br = new BufferedReader(new FileReader(csv));
try {
@@ -165,7 +165,7 @@ public class CSV {
br.close();
}
}
-
+
public Writer writer() throws FileNotFoundException {
return new Writer(false);
}
@@ -177,10 +177,10 @@ public class CSV {
public interface RowSetter {
public void row(Object ... objs);
}
-
+
public static class Saver implements RowSetter {
List<String> ls= new ArrayList<>();
-
+
@Override
public void row(Object ... objs) {
if(objs.length>0) {
@@ -197,7 +197,7 @@ public class CSV {
}
}
}
-
+
public List<String> asList() {
List<String> rv = ls;
ls = new ArrayList<>();
@@ -210,7 +210,7 @@ public class CSV {
private Writer(final boolean append) throws FileNotFoundException {
ps = new PrintStream(new FileOutputStream(csv,append));
}
-
+
@Override
public void row(Object ... objs) {
if(objs.length>0) {
@@ -233,7 +233,7 @@ public class CSV {
ps.println();
}
}
-
+
private void print(String s) {
boolean quote = s.matches(".*[,|\"].*");
if(quote) {
@@ -246,7 +246,7 @@ public class CSV {
ps.append(s);
}
-
+
}
/**
* Note: CSV files do not actually support Comments as a standard, but it is useful
@@ -257,32 +257,32 @@ public class CSV {
ps.printf(comment,objs);
ps.println();
}
-
+
public void flush() {
ps.flush();
}
-
+
public void close() {
flush();
ps.close();
}
-
+
public String toString() {
return csv.getAbsolutePath();
}
}
-
+
/**
* Provides a way to stop processing records from inside a Visit
*/
public void stop() {
- go = false;
+ go = false;
}
public void delete() {
csv.delete();
}
-
+
public String toString() {
return csv.getAbsolutePath();
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Chmod.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Chmod.java
index 70fabd82..037bd4a0 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Chmod.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Chmod.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,7 +26,7 @@ import java.io.IOException;
public interface Chmod {
public void chmod(File f) throws IOException;
-
+
public static final Chmod to755 = new Chmod() {
public void chmod(File f) throws IOException {
f.setExecutable(true, false);
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/FQI.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/FQI.java
index 07389aad..69d429c9 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/FQI.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/FQI.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,7 +44,7 @@ public class FQI {
sb.append(split[i]);
}
}
-
+
return sb==null?"":sb.toString();
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java
index f2c6be6f..3943cdcd 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,7 @@ import java.net.URI;
/**
* URI and URL, if the host does not have "dots", will interpret Host:port as Authority
- *
+ *
* This is very problematic for Containers, which like single name entries.
* @author Instrumental(Jonathan)
*
@@ -33,7 +33,7 @@ public class FixURIinfo {
private String auth;
private String host;
private int port;
-
+
public FixURIinfo(URI uri) {
auth = uri.getAuthority();
host = uri.getHost();
@@ -51,11 +51,11 @@ public class FixURIinfo {
}
}
}
-
+
public String getHost() {
return host;
}
-
+
public int getPort() {
return port;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/JsonOutputStream.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/JsonOutputStream.java
index e790766b..c4079d1a 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/JsonOutputStream.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/JsonOutputStream.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,12 +50,12 @@ public class JsonOutputStream extends OutputStream {
}
switch(b) {
case '{':
- case '[':
+ case '[':
ret = '\n';
++indent;
break;
case '}':
- case ']':
+ case ']':
--indent;
os.write('\n');
for (int i=0;i<indent;++i) {
@@ -65,7 +65,7 @@ public class JsonOutputStream extends OutputStream {
case ',':
ret = '\n';
break;
-
+
}
os.write(b);
prev = b;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/MaskFormatException.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/MaskFormatException.java
index 15390285..58bf5a6d 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/MaskFormatException.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/MaskFormatException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/MyConsole.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/MyConsole.java
index b930bc28..78e8b719 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/MyConsole.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/MyConsole.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/NetMask.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/NetMask.java
index 19fd1e2d..99105989 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/NetMask.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/NetMask.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,10 +21,10 @@
package org.onap.aaf.cadi.util;
-/*
+/*
* NetMask - a class to quickly validate whether a given IP is part of a mask, as defined by bytes or standard String format.
- *
- * Needs the IPV6 Mask Builder.
+ *
+ * Needs the IPV6 Mask Builder.
*/
public class NetMask {
private long mask;
@@ -32,16 +32,16 @@ public class NetMask {
public NetMask(byte[] inBytes) {
mask = derive(inBytes);
}
-
+
public NetMask(String string) throws MaskFormatException {
mask = derive(string,true);
}
-
+
public boolean isInNet(byte[] inBytes) {
long addr = derive(inBytes);
return (mask & addr) == addr;
}
-
+
public boolean isInNet(String str) {
long addr;
try {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java
index 156397b6..72d09bfe 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,7 +21,7 @@
/*
* Pool
- *
+ *
* Author: Jonathan
* 5/27/2011
*/
@@ -35,29 +35,29 @@ import org.onap.aaf.cadi.CadiException;
/**
* This Class pools on an As-Needed-Basis any particular kind of class, which is
* quite suitable for expensive operations.
- *
+ *
* The user calls "get" on a Pool, and if a waiting resource (T) is available,
* it will be returned. Otherwise, one will be created with the "Creator" class
* (must be defined for (T)).
- *
+ *
* You can Prime the instances to avoid huge startup costs
- *
+ *
* The returned "Pooled" object simply has to call "done()" and the object is
* returned to the pool. If the developer does not return the object, a memory
* leak does not occur. There are no references to the object once "get" is
* called. However, the developer who does not return the object when done
* obviates the point of the pool, as new Objects are created in place of the
* Object not returned when another call to "get" is made.
- *
+ *
* There is a cushion of extra objects, currently defaulted to MAX_RANGE. If the
* items returned become higher than the MAX_RANGE, the object is allowed to go
* out of scope, and be cleaned up. the default can be changed on a per-pool
* basis.
- *
+ *
* Class revamped for CadiExceptions and Access logging 10/4/2017
- *
+ *
* @author Jonathan
- *
+ *
* @param <T>
*/
public class Pool<T> {
@@ -69,7 +69,7 @@ public class Pool<T> {
/**
* only Simple List needed.
- *
+ *
* NOTE TO MAINTAINERS: THIS OBJECT DOES IT'S OWN SYNCHRONIZATION. All
* changes that touch list must account for correctly synchronizing list.
*/
@@ -101,7 +101,7 @@ public class Pool<T> {
/**
* Create a new Pool, given the implementation of Creator<T>, which must be
* able to create/destroy T objects at will.
- *
+ *
* @param creator
*/
public Pool(Creator<T> creator) {
@@ -110,7 +110,7 @@ public class Pool<T> {
list = new LinkedList<>();
logger = Log.NULL;
}
-
+
/**
* Attach Pool Logging activities to any other Logging Mechanism.
* @param logger
@@ -118,7 +118,7 @@ public class Pool<T> {
public void setLogger(Log logger) {
this.logger = logger;
}
-
+
public void log(Object ...objects) {
logger.log(objects);
}
@@ -126,10 +126,10 @@ public class Pool<T> {
/**
* Preallocate a certain number of T Objects. Useful for services so that
* the first transactions don't get hit with all the Object creation costs
- *
+ *
* @param lt
* @param prime
- * @throws CadiException
+ * @throws CadiException
*/
public void prime(int prime) throws CadiException {
for (int i = 0; i < prime; ++i) {
@@ -164,16 +164,16 @@ public class Pool<T> {
* This is the essential function for Pool. Get an Object "T" inside a
* "Pooled<T>" object. If there is a spare Object, then use it. If not, then
* create and pass back.
- *
+ *
* This one uses a Null LogTarget
- *
+ *
* IMPORTANT: When the use of this object is done (and the object is still
* in a valid state), then "done()" should be called immediately to allow
* the object to be reused. That is the point of the Pool...
- *
+ *
* If the Object is in an invalid state, then "toss()" should be used so the
* Pool doesn't pass on invalid objects to others.
- *
+ *
* @param lt
* @return
* @throws CadiException
@@ -205,7 +205,7 @@ public class Pool<T> {
* state. If not, they are tossed from the Pool. This is valuable to have
* when Remote Connections go down, and there is a question on whether the
* Pooled Objects are still functional.
- *
+ *
* @return
*/
public boolean validate() {
@@ -225,11 +225,11 @@ public class Pool<T> {
/**
* This is an internal method, used only by the Internal Pooled<T> class.
- *
+ *
* The Pooled<T> class "offers" it's Object back after use. It is an
* "offer", because Pool will simply destroy and remove the object if it has
* more than enough spares.
- *
+ *
* @param lt
* @param used
* @return
@@ -253,9 +253,9 @@ public class Pool<T> {
* The Creator Interface give the Pool the ability to Create, Destroy and
* Validate the Objects it is maintaining. Thus, it is a specially written
* Implementation for each type.
- *
+ *
* @author Jonathan
- *
+ *
* @param <T>
*/
public interface Creator<T> {
@@ -270,7 +270,7 @@ public class Pool<T> {
public interface Log {
public void log(Object ... o);
-
+
public final static Log NULL = new Log() {
@Override
public void log(Object ... o) {
@@ -281,7 +281,7 @@ public class Pool<T> {
* The "Pooled<T>" class is the transient class that wraps the actual Object
* T for API use/ It gives the ability to return ("done()", or "toss()") the
* Object to the Pool when processing is finished.
- *
+ *
* For Safety, i.e. to avoid memory leaks and invalid Object States, there
* is a "finalize" method. It is strictly for when coder forgets to return
* the object, or perhaps hasn't covered the case during Exceptions or
@@ -291,9 +291,9 @@ public class Pool<T> {
* However, we don't want Coding Mistakes to put the whole program in an
* invalid state, so if something happened such that "done()" or "toss()"
* were not called, the resource is still cleaned up as well as possible.
- *
+ *
* @author Jonathan
- *
+ *
* @param <T>
*/
public static class Pooled<T> {
@@ -302,7 +302,7 @@ public class Pool<T> {
/**
* Create the Wrapping Object Pooled<T>.
- *
+ *
* @param t
* @param pool
* @param logTarget
@@ -316,7 +316,7 @@ public class Pool<T> {
/**
* This is the key API for the Pool, as calling "done()" offers this
* object back to the Pool for reuse.
- *
+ *
* Do not use the Pooled<T> object again after calling "done()".
*/
public void done() {
@@ -329,12 +329,12 @@ public class Pool<T> {
* The user of the Object may discover that the Object t is no longer in
* a valid state. Don't put Garbage back in the Refrigerator... Toss it,
* if it's no longer valid.
- *
+ *
* toss() is also used for draining the Pool, etc.
- *
+ *
* toss() will attempt to destroy the Object by using the Creator
* Interface.
- *
+ *
*/
public void toss() {
if (pool != null) {
@@ -360,7 +360,7 @@ public class Pool<T> {
/**
* Get the maximum number of spare objects allowed at any moment
- *
+ *
* @return
*/
public int getMaxRange() {
@@ -369,9 +369,9 @@ public class Pool<T> {
/**
* Set a Max Range for numbers of spare objects waiting to be used.
- *
+ *
* No negative numbers are allowed
- *
+ *
* @return
*/
public void setMaxRange(int max_range) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java
index 4f41629d..a6e52a44 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,7 +26,7 @@ package org.onap.aaf.cadi.util;
*
* Note: Copied from Inno to avoid linking issues.
* Note: I read the String split and Pattern split code, and we can do this more efficiently for a single Character
- *
+ *
* 8/20/2015
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/SubStandardConsole.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/SubStandardConsole.java
index a85020ff..6fe56725 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/SubStandardConsole.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/SubStandardConsole.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,12 +28,12 @@ import java.io.InputStreamReader;
// Substandard, because System.in doesn't do Passwords..
public class SubStandardConsole implements MyConsole {
private final static char[] BLANK = new char[0];
- private final BufferedReader br;
+ private final BufferedReader br;
public SubStandardConsole() {
br = new BufferedReader(new InputStreamReader(System.in));
}
-
+
@Override
public String readLine(String fmt, Object... args) {
String rv;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/TheConsole.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/TheConsole.java
index da99d06d..0ea1b0a3 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/TheConsole.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/TheConsole.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,7 +35,7 @@ public class TheConsole implements MyConsole {
public char[] readPassword(String fmt, Object... args) {
return System.console().readPassword(fmt, args);
}
-
+
public static boolean implemented() {
return System.console()!=null;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Timing.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Timing.java
index 529849de..3f9b9b4d 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Timing.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Timing.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/UserChainManip.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/UserChainManip.java
index d42aaf55..b9cee7fb 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/UserChainManip.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/UserChainManip.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,11 +24,11 @@ package org.onap.aaf.cadi.util;
import org.onap.aaf.cadi.UserChain;
public class UserChainManip {
- /**
+ /**
Build an element in the correct format for UserChain.
Format:<APP>:<ID>:<protocol>[:AS][,<APP>:<ID>:<protocol>]*
@see UserChain
- */
+ */
public static StringBuilder build(StringBuilder sb, String app, String id, UserChain.Protocol proto, boolean as) {
boolean mayAs;
if (!(mayAs=sb.length()==0)) {
@@ -44,7 +44,7 @@ public class UserChainManip {
}
return sb;
}
-
+
public static String idToNS(String id) {
if (id==null) {
return "";
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Vars.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Vars.java
index 417351f5..bf9ebc24 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Vars.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Vars.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,11 +47,11 @@ public class Vars {
public static String convert(final StringBuilder holder, final String text, final Object ... vars) {
StringBuilder sb = null;
int idx,index=0,prev = 0;
-
+
if (text.contains("%s")) {
sb = new StringBuilder();
}
-
+
StringBuilder[] sbs = new StringBuilder[] {sb,holder};
boolean replace, clearIndex = false;
int c;
@@ -66,12 +66,12 @@ public class Vars {
if (holder!=null) {
holder.append(text,prev,idx);
}
-
+
boolean go = true;
while (go) {
if (text.length()>++idx) {
switch(c=text.charAt(idx)) {
- case '0': case '1': case '2': case '3': case '4':
+ case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
index *=10;
index +=(c-'0');
@@ -106,7 +106,7 @@ public class Vars {
}
}
}
-
+
if (sb!=null) {
sb.append(text,prev,text.length());
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Action.java b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Action.java
index ebcfa9f7..5574eef5 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Action.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Action.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,11 +23,11 @@ package org.onap.aaf.cadi.wsse;
/**
* Interface to specify an action deep within a parsing tree on a local object
- *
+ *
* We use a Generic so as to be flexible on create what that object actually is. This is passed in at the
* root "parse" call of Match. Similar to a "Visitor" Pattern, this object is passed upon reaching the right
* point in a parse tree.
- *
+ *
* @author Jonathan
*
* @param <OUTPUT>
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Match.java b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Match.java
index d0a7da47..e46d5a02 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Match.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Match.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,18 +26,18 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
/**
- * Match Class allows you to build an automatic Tree of StAX (or StAX like)
+ * Match Class allows you to build an automatic Tree of StAX (or StAX like)
* Objects for frequent use.
- *
+ *
* OBJECT is a type which you which to do some end Actions on, similar to a Visitor pattern, see Action
- *
+ *
* Note: We have implemented with XReader and XEvent, rather than StAX for performance reasons.
- *
+ *
* @see Action
* @see Match
* @see XEvent
* @see XReader
- *
+ *
* @author Jonathan
*
* @param <OUTPUT>
@@ -50,7 +50,7 @@ public class Match<OUTPUT> {
private Action<OUTPUT> action = null;
private boolean stopAfter;
private boolean exclusive;
-
+
@SafeVarargs
public Match(String ns, String name, Match<OUTPUT> ... next) {
@@ -61,7 +61,7 @@ public class Match<OUTPUT> {
if (!m.stopAfter)m.prev = this;
}
}
-
+
public Match<OUTPUT> onMatch(OUTPUT output, XReader reader) throws XMLStreamException {
while (reader.hasNext()) {
XEvent event = reader.nextEvent();
@@ -111,10 +111,10 @@ public class Match<OUTPUT> {
stopAfter = true;
return this;
}
-
+
/**
* Mark that this Object MUST be matched at this level or stop parsing and end
- *
+ *
* @param action
* @return
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/WSSEParser.java b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/WSSEParser.java
index 787f1b4b..0c3cca40 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/WSSEParser.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/WSSEParser.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,15 +30,15 @@ import org.onap.aaf.cadi.BasicCred;
/**
* WSSE Parser
- *
- * Read the User and Password from WSSE Formatted SOAP Messages
- *
+ *
+ * Read the User and Password from WSSE Formatted SOAP Messages
+ *
* This class uses StAX so that processing is stopped as soon as the Security User/Password are read into BasicCred, or the Header Ends
- *
+ *
* This class is intended to be created once (or very few times) and reused as much as possible.
- *
+ *
* It is as thread safe as StAX parsing is.
- *
+ *
* @author Jonathan
*/
public class WSSEParser {
@@ -71,7 +71,7 @@ public class WSSEParser {
).exclusive()// Envelope must match Header, and no other. FYI, Body comes after Header short circuits (see above), so it's ok
).exclusive(); // root must be Envelope
}
-
+
public XMLStreamException parse(BasicCred bc, InputStream is) {
try {
parseTree.onMatch(bc, new XReader(is));
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XEvent.java b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XEvent.java
index 187d5b1e..d6918292 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XEvent.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XEvent.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,12 +26,12 @@ import javax.xml.stream.events.XMLEvent;
/**
* XEvent
- *
+ *
* This mechanism mimics a minimal portion of StAX "XMLEvent", enough to work with minimal XReader.
- *
+ *
* We implement the same interface, as much as minimally necessary, as XMLEvent for these small usages so as to
* be interchangeable in the future, if so desired
- *
+ *
* @author Jonathan
*
*/
@@ -58,7 +58,7 @@ public abstract class XEvent {
public NamedXEvent(QName qname) {
this.qname = qname;
}
-
+
public QName getName() {
return qname;
}
@@ -79,7 +79,7 @@ public abstract class XEvent {
public EndElement(String ns, String tag) {
super(new QName(ns,tag));
}
-
+
@Override
public int getEventType() {
return XMLEvent.END_ELEMENT;
@@ -101,14 +101,14 @@ public abstract class XEvent {
return data;
}
}
-
+
public static class StartDocument extends XEvent {
@Override
public int getEventType() {
return XMLEvent.START_DOCUMENT;
}
-
+
}
public static class EndDocument extends XEvent {
@@ -117,7 +117,7 @@ public abstract class XEvent {
public int getEventType() {
return XMLEvent.END_DOCUMENT;
}
-
+
}
public static class Comment extends XEvent {
public final String value;
@@ -129,7 +129,7 @@ public abstract class XEvent {
public int getEventType() {
return XMLEvent.COMMENT;
}
-
+
}
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XReader.java b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XReader.java
index aa46bec5..e820197b 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XReader.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XReader.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,16 +34,16 @@ import javax.xml.stream.XMLStreamException;
/**
* XReader
- * This class works similarly as StAX, except StAX has more behavior than is needed. That would be ok, but
+ * This class works similarly as StAX, except StAX has more behavior than is needed. That would be ok, but
* StAX also was Buffering in their code in such as way as to read most if not all the incoming stream into memory,
* defeating the purpose of pre-reading only the Header
- *
+ *
* This Reader does no back-tracking, but is able to create events based on syntax and given state only, leaving the
* Read-ahead mode of the InputStream up to the other classes.
- *
- * At this time, we only implement the important events, though if this is good enough, it could be expanded, perhaps to
+ *
+ * At this time, we only implement the important events, though if this is good enough, it could be expanded, perhaps to
* replace the original XMLReader from StAX.
- *
+ *
* @author Jonathan
*
*/
@@ -53,18 +53,18 @@ public class XReader {
private InputStream is;
private ByteArrayOutputStream baos;
private int state, count, last;
-
+
private Stack<Map<String,String>> nsses;
-
+
public XReader(InputStream is) {
this.is = is;
curr = another = null;
baos = new ByteArrayOutputStream();
- state = BEGIN_DOC;
+ state = BEGIN_DOC;
count = 0;
nsses = new Stack<Map<String,String>>();
}
-
+
public boolean hasNext() throws XMLStreamException {
if (curr==null) {
curr = parse();
@@ -78,7 +78,7 @@ public class XReader {
return xe;
}
- //
+ //
// State Flags
//
// Note: The State of parsing XML can be complicated. There are too many to cleanly keep in "booleans". Additionally,
@@ -100,20 +100,20 @@ public class XReader {
// useful combined Comment states
private final static int IN_COMMENT=COMMENT|COMMENT_E|COMMENT_D1|COMMENT_D2;
private final static int COMPLETE_COMMENT = COMMENT|COMMENT_E|COMMENT_D1|COMMENT_D2|COMMENT_D3|COMMENT_D4;
-
-
+
+
private XEvent parse() throws XMLStreamException {
Map<String,String> nss = nsses.isEmpty()?null:nsses.peek();
XEvent rv;
- if ((rv=another)!=null) { // "another" is a tag that may have needed to be created, but not
+ if ((rv=another)!=null) { // "another" is a tag that may have needed to be created, but not
// immediately returned. Save for next parse. If necessary, this could be turned into
// a FIFO storage, but a single reference is enough for now.
another = null; // "rv" is now set for the Event, and will be returned. Set to Null.
} else {
boolean go = true;
int c=0;
-
+
try {
while (go && (c=is.read())>=0) {
++count;
@@ -134,9 +134,9 @@ public class XReader {
String ns;
switch(t.state&(START_TAG|END_TAG)) {
case START_TAG:
- nss = getNss(nss,t); // Only Start Tags might have NS Attributes
- // Get any NameSpace elements from tag. If there are, nss will become
- // a new Map with all the previous NSs plus the new. This provides
+ nss = getNss(nss,t); // Only Start Tags might have NS Attributes
+ // Get any NameSpace elements from tag. If there are, nss will become
+ // a new Map with all the previous NSs plus the new. This provides
// scoping behavior when used with the Stack
// drop through on purpose
case END_TAG:
@@ -148,8 +148,8 @@ public class XReader {
if (ns==null)
throw new XMLStreamException("Invalid Namespace Prefix at " + count);
go = false;
- switch(t.state) { // based on
- case DOC_TYPE:
+ switch(t.state) { // based on
+ case DOC_TYPE:
rv = new XEvent.StartDocument();
break;
case COMMENT:
@@ -168,14 +168,14 @@ public class XReader {
if (last=='/')another = new XEvent.EndElement(ns,t.name);
}
if (cxe!=null) { // if there is a Character Event, it actually should go first. ow.
- another = rv; // Make current Event the "another" or next event, and
+ another = rv; // Make current Event the "another" or next event, and
rv = cxe; // send Character Event now
}
break;
case ' ':
case '\t':
case '\n':
- if ((state&BEGIN_DOC)==BEGIN_DOC) { // if Whitespace before doc, just ignore
+ if ((state&BEGIN_DOC)==BEGIN_DOC) { // if Whitespace before doc, just ignore
break;
}
// fallthrough on purpose
@@ -190,17 +190,17 @@ public class XReader {
} catch (IOException e) {
throw new XMLStreamException(e); // all errors parsing will be treated as XMLStreamErrors (like StAX)
}
- if (c==-1 && (state&BEGIN_DOC)==BEGIN_DOC) { // Normally, end of stream is ok, however, we need to know if the
- throw new XMLStreamException("Premature End of File"); // document isn't an XML document, so we throw exception if it
+ if (c==-1 && (state&BEGIN_DOC)==BEGIN_DOC) { // Normally, end of stream is ok, however, we need to know if the
+ throw new XMLStreamException("Premature End of File"); // document isn't an XML document, so we throw exception if it
} // hasn't yet been determined to be an XML Doc
}
return rv;
}
-
+
/**
* parseTag
- *
- * Parsing a Tag is somewhat complicated, so it's helpful to separate this process from the
+ *
+ * Parsing a Tag is somewhat complicated, so it's helpful to separate this process from the
* higher level Parsing effort
* @return
* @throws IOException
@@ -213,7 +213,7 @@ public class XReader {
int c, quote=0; // If "quote" is 0, then we're not in a quote. We set ' (in pretag) or " in attribs accordingly to denote quoted
String prefix=null,name=null,value=null;
baos.reset();
-
+
while (go && (c=is.read())>=0) {
++count;
if (quote!=0) { // If we're in a quote, we only end if we hit another quote of the same time, not preceded by \
@@ -225,7 +225,7 @@ public class XReader {
} else if ((state&COMMENT)==COMMENT) { // similar to Quote is being in a comment
switch(c) {
case '-':
- switch(state) { // XML has a complicated Quote set... <!-- --> ... we keep track if each has been met with flags.
+ switch(state) { // XML has a complicated Quote set... <!-- --> ... we keep track if each has been met with flags.
case COMMENT|COMMENT_E:
state|=COMMENT_D1;
break;
@@ -259,7 +259,7 @@ public class XReader {
}
} else { // Normal Tag Processing loop
switch(c) {
- case '?':
+ case '?':
switch(state & (QUESTION_F|QUESTION)) { // Validate the state of Doc tag... <?xml ... ?>
case QUESTION_F:
state |= DOC_TYPE;
@@ -273,7 +273,7 @@ public class XReader {
}
break;
case '!':
- if (last=='<') {
+ if (last=='<') {
state|=COMMENT|COMMENT_E; // likely a comment, continue processing in Comment Loop
}
baos.write(c);
@@ -321,7 +321,7 @@ public class XReader {
// Fallthrough ok
default:
baos.write(c); // write any unprocessed bytes into buffer
-
+
}
}
last = c;
@@ -338,12 +338,12 @@ public class XReader {
/**
* getNSS
- *
+ *
* If the tag contains some Namespace attributes, create a new nss from the passed in one, copy all into it, then add
* This provides Scoping behavior
- *
+ *
* if Nss is null in the first place, create an new nss, so we don't have to deal with null Maps.
- *
+ *
* @param nss
* @param t
* @return
@@ -374,10 +374,10 @@ public class XReader {
/**
* The result of the parseTag method
- *
+ *
* Data is split up into prefix, name and value portions. "Tags" with Values that are inside a Tag are known in XLM
- * as Attributes.
- *
+ * as Attributes.
+ *
* @author Jonathan
*
*/
@@ -390,7 +390,7 @@ public class XReader {
this.prefix = prefix;
this.name = name;
this.value = value;
- attribs = null;
+ attribs = null;
}
/**
@@ -404,7 +404,7 @@ public class XReader {
}
attribs.add(attrib);
}
-
+
public String toString() {
StringBuffer sb = new StringBuffer();
if (prefix!=null) {
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_Get.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_Get.java
index b275790c..270a4af5 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_Get.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_Get.java
@@ -95,7 +95,7 @@ public class JU_Get {
@SuppressWarnings("unused")
private String thrower = null;
- public TestBean() { }
+ public TestBean() { }
public String getProperty1() { return property1; }
public void setProperty1(final String value) { this.property1 = value; }
public String getProperty2() { return property2; }
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_MapBathConverter.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_MapBathConverter.java
index 2be51ece..7ea8e6fc 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_MapBathConverter.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_MapBathConverter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -45,7 +45,7 @@ import junit.framework.Assert;
/**
* Test a simple Migration conversion tool for CADI
- *
+ *
* @author Instrumental(Jonathan)
*
*/
@@ -62,19 +62,19 @@ public class JU_MapBathConverter {
public static void createFile() throws IOException {
// Note, you cate a "MapBathConverter" by access to a File.
// We will create that file now. Local is fine.
- csv = new CSV(access,"JU_MapBathConverter.csv");
+ csv = new CSV(access,"JU_MapBathConverter.csv");
}
-
+
@BeforeClass
public static void beforeClass() {
expected = new ArrayList<>();
}
-
+
@Before
public void before() {
expected.clear();
}
-
+
@Test
public void test() throws IOException, CadiException {
CSV.Writer cw = csv.writer();
@@ -88,14 +88,14 @@ public class JU_MapBathConverter {
// Style 1 - Incoming ID/pass, create new cred with NweID and same Pass
cw.row(exp(bath(OLD_ID,SHARED_PASS)), exp(NEW_USER_SOMETHING_ORG),sdf.format(gc.getTime()));
// the response should be Basic with NEW_ID and OLD_PASS
-
+
// Style 2
cw.row(exp(bath(OLD_ID,"OLD_PASS")), exp(bath(NEW_USER_SOMETHING_ORG,"NEW_PASS")),sdf.format(gc.getTime()));
} finally {
cw.close();
}
-
+
final Iterator<String> exp = expected.iterator();
csv.visit(new Visitor() {
@Override
@@ -120,7 +120,7 @@ public class JU_MapBathConverter {
}
}
});
-
+
MapBathConverter mbc = new MapBathConverter(access, csv);
// Check no lookup just returns the same
@@ -128,12 +128,12 @@ public class JU_MapBathConverter {
Iterator<String> exp1 = expected.iterator();
// there's no passwords in CSV
- String old = exp1.next();
+ String old = exp1.next();
String nw = exp1.next();
Assert.assertEquals(nw, mbc.convert(access,old));
-
+
Assert.assertEquals(bath(NEW_USER_SOMETHING_ORG,SHARED_PASS), mbc.convert(access,bath(OLD_ID,SHARED_PASS)));
-
+
// Style 1 (new cred, old password)
old = exp1.next();
nw = bath(exp1.next(),SHARED_PASS);
@@ -162,7 +162,7 @@ public class JU_MapBathConverter {
} finally {
cw.close();
}
-
+
try {
new MapBathConverter(access, csv);
Assert.fail("Invalid Data should throw Exception");
@@ -184,7 +184,7 @@ public class JU_MapBathConverter {
} finally {
cw.close();
}
-
+
try {
new MapBathConverter(access, csv);
Assert.fail("file with too few rows should throw exception");
@@ -205,7 +205,7 @@ public class JU_MapBathConverter {
Assert.assertTrue("Correctly thrown Exception",true);
}
}
-
+
@Test
public void testBadRows() throws IOException {
try {
@@ -215,7 +215,7 @@ public class JU_MapBathConverter {
} finally {
cw.close();
}
-
+
try {
new MapBathConverter(access,csv);
Assert.fail("Non Existent File should throw exception");
@@ -225,11 +225,11 @@ public class JU_MapBathConverter {
} finally {
csv.delete();
}
-
- // Check for deletion
+
+ // Check for deletion
Assert.assertFalse(csv.toString() + "should have been deleted",new File(csv.toString()).exists());
}
-
+
private String bath(String user, String password) throws IOException {
StringBuilder sb = new StringBuilder(user);
sb.append(':');
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java
index 1fe6a753..3b3461c1 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -46,10 +46,10 @@ public class JU_RegistrationPropHolder {
rph = new RegistrationPropHolder(pa,20);
} catch (CadiException e) {
Assert.assertEquals(
- "\ncadi_latitude must be defined." +
+ "\ncadi_latitude must be defined." +
"\ncadi_longitude must be defined.",e.getMessage());
}
-
+
try {
pa.setProperty(Config.CADI_LATITUDE, "32.7");
rph = new RegistrationPropHolder(pa,20);
@@ -57,10 +57,10 @@ public class JU_RegistrationPropHolder {
Assert.assertEquals(
"\ncadi_longitude must be defined.",e.getMessage());
}
-
+
pa.setProperty(Config.CADI_LONGITUDE, "-72.0");
rph = new RegistrationPropHolder(pa,ju_port);
-
+
////////////////
// Validate Default Properties
////////////////
@@ -107,21 +107,21 @@ public class JU_RegistrationPropHolder {
final String url = "https://aaf.osaaf.org:8095/org.osaaf.aaf.service:2.1";
String name="theName";
assertEquals(url,rph.replacements(getClass().getSimpleName(),url, name, ""));
-
+
String alu = "aaf.osaaf.org:8095";
String curl = url.replace(alu, Config.AAF_LOCATE_URL_TAG);
pa.setProperty(Config.AAF_LOCATE_URL,"https://"+alu);
assertEquals(url.replace("8095","8095/locate"),rph.replacements(getClass().getSimpleName(),curl, name, ""));
-
+
String root_ns = "org.osaaf.aaf";
curl = url.replace(root_ns, "AAF_NS");
pa.setProperty(Config.AAF_ROOT_NS,root_ns);
assertEquals(url,rph.replacements(getClass().getSimpleName(),curl, name, ""));
-
+
curl = url.replace(root_ns, "%AAF_NS");
pa.setProperty(Config.AAF_ROOT_NS,root_ns);
assertEquals(url,rph.replacements(getClass().getSimpleName(),curl, name, ""));
-
+
final String fqdn = "%C.%CNS.%NS.%N";
String target = "myns.theName";
assertEquals(target,rph.replacements(getClass().getSimpleName(),fqdn, name, ""));
@@ -129,11 +129,11 @@ public class JU_RegistrationPropHolder {
pa.setProperty(Config.AAF_LOCATOR_CONTAINER_NS+".hello", "mycontns");
target = "mycontns.myns.theName";
assertEquals(target,rph.replacements(getClass().getSimpleName(),fqdn, name, ".hello"));
-
+
pa.setProperty(Config.AAF_LOCATOR_CONTAINER+".hello","helloC");
target = "helloC.mycontns.myns.theName";
assertEquals(target,rph.replacements(getClass().getSimpleName(),fqdn, name, ".hello"));
-
+
pa.setProperty(Config.AAF_LOCATOR_CONTAINER_NS,"c_ns");
target = "c_ns.myns.theName";
assertEquals(target,rph.replacements(getClass().getSimpleName(),fqdn, name, ""));
@@ -144,6 +144,6 @@ public class JU_RegistrationPropHolder {
Assert.fail();
}
}
-
+
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfo.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfo.java
index 98c1a292..7d34aab7 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfo.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfo.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -45,16 +45,16 @@ import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.cadi.config.SecurityInfo;
public class JU_SecurityInfo {
-
+
private static PropAccess access;
-
+
private static final String keyStoreFileName = "src/test/resources/keystore.p12";
private static final String keyStorePassword = "Password for the keystore";
private static final String keyPassword = "Password for the key";
-
+
private static final String trustStoreFileName = "src/test/resources/truststore.jks";
private static final String trustStorePasswd = "Password for the truststore";
-
+
@BeforeClass
public static void setupOnce() throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException {
KeyStore keyStore = KeyStore.getInstance("PKCS12");
@@ -65,7 +65,7 @@ public class JU_SecurityInfo {
trustStore.load(null, null);
trustStore.store(new FileOutputStream(trustStoreFileName), trustStorePasswd.toCharArray());
}
-
+
@Before
public void setup() throws IOException {
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
@@ -73,7 +73,7 @@ public class JU_SecurityInfo {
access.setProperty(Config.CADI_KEYSTORE, keyStoreFileName);
access.setProperty(Config.CADI_KEYSTORE_PASSWORD, access.encrypt(keyStorePassword));
access.setProperty(Config.CADI_KEY_PASSWORD, access.encrypt(keyPassword));
-
+
access.setProperty(Config.CADI_TRUSTSTORE, trustStoreFileName);
access.setProperty(Config.CADI_TRUSTSTORE_PASSWORD, access.encrypt(trustStorePasswd));
}
@@ -97,7 +97,7 @@ public class JU_SecurityInfo {
assertNotNull(si.getSSLSocketFactory());
assertNotNull(si.getSSLContext());
assertNotNull(si.getKeyManagers());
-
+
access.setProperty(Config.CADI_TRUST_MASKS, "123.123.123.123");
si = new SecurityInfo(access);
}
@@ -115,8 +115,8 @@ public class JU_SecurityInfo {
@SuppressWarnings("unused")
SecurityInfo si = new SecurityInfo(access);
}
-
-
+
+
@Test(expected = NumberFormatException.class)
public void badTrustMaskTest() throws CadiException {
access.setProperty(Config.CADI_TRUST_MASKS, "trustMask");
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfoC.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfoC.java
index da99f9ac..6826c2fb 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfoC.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfoC.java
@@ -75,7 +75,7 @@ public class JU_SecurityInfoC {
// SecurityInfoC<HttpURLConnection> siClone = SecurityInfoC.instance(new PropAccess(), HttpURLConnection.class);
// assertThat(siClone, is(si));
// }
-
+
@Test
public void setTest() throws MalformedURLException, CadiException {
SecurityInfoC<HttpURLConnectionStub> si = SecurityInfoC.instance(new PropAccess(), HttpURLConnectionStub.class);
@@ -95,9 +95,9 @@ public class JU_SecurityInfoC {
}
public static class HttpURLConnectionStub extends HttpURLConnection {
- public HttpURLConnectionStub() throws MalformedURLException { super(new URL("http://www.example.com")); }
- @Override public void disconnect() { }
- @Override public boolean usingProxy() { return false; }
+ public HttpURLConnectionStub() throws MalformedURLException { super(new URL("http://www.example.com")); }
+ @Override public void disconnect() { }
+ @Override public boolean usingProxy() { return false; }
@Override public void connect() throws IOException { }
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/filter/test/JU_PathFilter.java b/cadi/core/src/test/java/org/onap/aaf/cadi/filter/test/JU_PathFilter.java
index 78b0fbc6..418fa1eb 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/filter/test/JU_PathFilter.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/filter/test/JU_PathFilter.java
@@ -48,16 +48,16 @@ import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.cadi.filter.PathFilter;
public class JU_PathFilter {
-
+
private PropAccess access;
-
+
@Mock private FilterConfig filterConfigMock;
@Mock private ServletContext contextMock;
@Mock private HttpServletRequest reqMock;
@Mock private HttpServletResponse respMock;
@Mock private FilterChain chainMock;
@Mock private Principal princMock;
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
@@ -77,28 +77,28 @@ public class JU_PathFilter {
} catch (ServletException e) {
assertThat(e.getMessage(), is("PathFilter - pathfilter_ns is not set"));
}
-
+
when(contextMock.getAttribute(Config.PATHFILTER_NS)).thenReturn(5);
when(contextMock.getAttribute(Config.PATHFILTER_STACK)).thenReturn(5);
when(contextMock.getAttribute(Config.PATHFILTER_URLPATTERN)).thenReturn(5);
when(contextMock.getAttribute(Config.PATHFILTER_NOT_AUTHORIZED_MSG)).thenReturn(5);
pathFilter.init(filterConfigMock);
-
+
pathFilter.doFilter(reqMock, respMock, chainMock);
when(reqMock.isUserInRole(anyString())).thenReturn(true);
pathFilter.doFilter(reqMock, respMock, chainMock);
-
+
pathFilter.destroy();
pathFilter = new PathFilter();
pathFilter.init(filterConfigMock);
-
+
pathFilter.doFilter(reqMock, respMock, chainMock);
when(reqMock.isUserInRole(anyString())).thenReturn(false);
pathFilter.doFilter(reqMock, respMock, chainMock);
-
+
pathFilter.destroy();
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_ConfigPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_ConfigPrincipal.java
index b37a38a1..22525419 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_ConfigPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_ConfigPrincipal.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,7 +40,7 @@ public class JU_ConfigPrincipal {
private final String b64encoded = "VXNlcjpwYXNz";
private Field content_field;
-
+
@Before
public void setup() throws NoSuchFieldException {
content_field = ConfigPrincipal.class.getDeclaredField("content");
@@ -50,7 +50,7 @@ public class JU_ConfigPrincipal {
@Test
public void testConfigPrincipalStringString() throws IOException, IllegalArgumentException, IllegalAccessException {
ConfigPrincipal p = new ConfigPrincipal(name, pass);
-
+
assertThat(p.getName(), is(name));
assertThat(p.toString(), is(name));
assertThat(p.getCred(), is(pass.getBytes()));
@@ -65,7 +65,7 @@ public class JU_ConfigPrincipal {
@Test
public void testConfigPrincipalStringByteArray() throws IOException, IllegalArgumentException, IllegalAccessException {
ConfigPrincipal p = new ConfigPrincipal(name, pass.getBytes());
-
+
assertThat(p.getName(), is(name));
assertThat(p.toString(), is(name));
assertThat(p.getCred(), is(pass.getBytes()));
@@ -76,5 +76,5 @@ public class JU_ConfigPrincipal {
// One more time for coverage purposes
assertThat(p.getAsBasicAuthHeader(), is("Basic " + b64encoded));
}
-
+
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
index 9ed5fd1e..c3e5cb67 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
@@ -104,14 +104,14 @@ public class JU_LocalLur {
info = lur.dumpInfo();
assertThat(info.size(), is(1));
assertThat(info.get(0).user, is("user1@domain"));
-
+
when(permMock.getKey()).thenReturn("groupA");
assertThat(lur.handlesExclusively(permMock), is(true));
when(permMock.getKey()).thenReturn("groupB");
assertThat(lur.handlesExclusively(permMock), is(false));
-
+
assertThat(lur.fish(null, null), is(false));
-
+
Principal princ = new ConfigPrincipal("user1@localized", encrypted);
lur = new LocalLur(access, "user1@localized%" + password + ":groupA", null);
@@ -124,9 +124,9 @@ public class JU_LocalLur {
princ = new ConfigPrincipal("user1@localized", "badpass");
assertThat(lur.fish(princ, lur.createPerm("groupB")), is(false));
-
+
assertThat(lur.handles(null), is(false));
-
+
lur.fishAll(null, null);
List<Permission> perms = new ArrayList<>();
@@ -136,7 +136,7 @@ public class JU_LocalLur {
lur.fishAll(princ, perms);
princ = new ConfigPrincipal("user1@localized", "badpass");
lur.fishAll(princ, perms);
-
+
assertThat(lur.validate(null, null, null, null), is(false));
assertThat(lur.validate("user", null, "badpass".getBytes(), null), is(false));
assertThat(lur.validate("user1@localized", null, encrypted.getBytes(), null), is(false));
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java
index e67e096f..7356dbb7 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_CachedBasicPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_CachedBasicPrincipal.java
index 5b780c9a..eb96a168 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_CachedBasicPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_CachedBasicPrincipal.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_Kind.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_Kind.java
index 04b9367b..b69eb3ec 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_Kind.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_Kind.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_OAuth2FormPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_OAuth2FormPrincipal.java
index c9623fb9..6ca74e27 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_OAuth2FormPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_OAuth2FormPrincipal.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_StringTagLookup.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_StringTagLookup.java
index a76e01f7..4ea3694c 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_StringTagLookup.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_StringTagLookup.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TaggedPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TaggedPrincipal.java
index 3dfe8d86..eb3afa35 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TaggedPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TaggedPrincipal.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TrustPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TrustPrincipal.java
index ed1ae4c9..1162b0eb 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TrustPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TrustPrincipal.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_UnAuthPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_UnAuthPrincipal.java
index 60fc88e2..efba241c 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_UnAuthPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_UnAuthPrincipal.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_X509Principal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_X509Principal.java
index ea45c128..6e02988b 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_X509Principal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_X509Principal.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/basic/test/JU_BasicHttpTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/basic/test/JU_BasicHttpTafResp.java
index 641545ca..35a27e45 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/basic/test/JU_BasicHttpTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/basic/test/JU_BasicHttpTafResp.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java
index 47d8f8d1..7154ab60 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java
@@ -68,7 +68,7 @@ public class JU_DenialOfServiceTaf {
private File dosIDFile;
private File dosDir;
private final String dosDirName = "test";
-
+
private final String id1 = "id1";
private final String id2 = "id2";
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTafResp.java
index b9b7b16d..034e974e 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTafResp.java
@@ -1,5 +1,5 @@
/**
- *
+ *
* ============LICENSE_START====================================================
* org.onap.aaf
* ===========================================================================
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java
index 4dba8edb..86ecb903 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
-* *
+* *
* * http://www.apache.org/licenses/LICENSE-2.0
-* *
+* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,15 +39,15 @@ import org.onap.aaf.cadi.taf.AbsTafResp;
import org.onap.aaf.cadi.taf.TafResp.RESP;
public class JU_AbsTafResp {
-
+
private static final String JUNIT = "Junit";
private static final String name = "name";
private static final String tag = "tag";
private static final String description = "description";
-
+
private Access access;
private TaggedPrincipal taggedPrinc;
-
+
@Before
public void setup() {
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java
index 8e103893..0e988f2d 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -71,16 +71,16 @@ public class JU_EpiTaf {
}
class TryAnotherTafResp implements TafResp {
- @Override public boolean isValid() { return false; }
- @Override public String desc() { return null; }
- @Override public RESP isAuthenticated() { return RESP.TRY_ANOTHER_TAF; }
- @Override public RESP authenticate() throws IOException { return null; }
- @Override public TaggedPrincipal getPrincipal() { return null; }
+ @Override public boolean isValid() { return false; }
+ @Override public String desc() { return null; }
+ @Override public RESP isAuthenticated() { return RESP.TRY_ANOTHER_TAF; }
+ @Override public RESP authenticate() throws IOException { return null; }
+ @Override public TaggedPrincipal getPrincipal() { return null; }
@Override public String getTarget() {return "unknown";}
- @Override public Access getAccess() { return null; }
+ @Override public Access getAccess() { return null; }
@Override public boolean isFailedAttempt() { return false; }
@Override public float timing() { return 0; }
- @Override public void timing(long start) {}
+ @Override public void timing(long start) {}
@Override public String taf() {return "JUnit";}
}
@@ -89,16 +89,16 @@ public class JU_EpiTaf {
}
class TryAuthenticatingResp implements TafResp {
- @Override public boolean isValid() { return false; }
- @Override public String desc() { return null; }
- @Override public RESP isAuthenticated() { return RESP.TRY_AUTHENTICATING; }
- @Override public RESP authenticate() throws IOException { return null; }
- @Override public TaggedPrincipal getPrincipal() { return null; }
+ @Override public boolean isValid() { return false; }
+ @Override public String desc() { return null; }
+ @Override public RESP isAuthenticated() { return RESP.TRY_AUTHENTICATING; }
+ @Override public RESP authenticate() throws IOException { return null; }
+ @Override public TaggedPrincipal getPrincipal() { return null; }
@Override public String getTarget() {return "unknown";}
- @Override public Access getAccess() { return null; }
- @Override public boolean isFailedAttempt() { return false; }
+ @Override public Access getAccess() { return null; }
+ @Override public boolean isFailedAttempt() { return false; }
@Override public float timing() { return 0; }
- @Override public void timing(long start) {}
+ @Override public void timing(long start) {}
@Override public String taf() {return "JUnit";}
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_NullTaf.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_NullTaf.java
index fdb152c0..df9404af 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_NullTaf.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_NullTaf.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,21 +43,21 @@ public class JU_NullTaf {
TafResp singleton1 = nt.validate(null);
TafResp singleton2 = nt.validate(null, null, null);
Resp singleton3 = nt.revalidate(null, null);
-
+
assertThat(singleton1, is(singleton2));
-
+
assertFalse(singleton1.isValid());
-
+
assertThat(singleton1.isAuthenticated(), is(RESP.NO_FURTHER_PROCESSING));
-
+
assertThat(singleton1.desc(), is("All Authentication denied"));
-
+
assertThat(singleton1.authenticate(), is(RESP.NO_FURTHER_PROCESSING));
-
+
assertThat(singleton1.getPrincipal(), is(nullValue()));
-
+
assertThat(singleton1.getAccess(), is(Access.NULL));
-
+
assertTrue(singleton1.isFailedAttempt());
assertThat(singleton3, is(Resp.NOT_MINE));
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java
index 316678ec..8b918321 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustNotTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustNotTafResp.java
index 4b28d6a4..770d8931 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustNotTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustNotTafResp.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustTafResp.java
index 5a23062d..7bbc950f 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustTafResp.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_AES.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_AES.java
index a3e0db0d..72dfc3e8 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_AES.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_AES.java
@@ -86,7 +86,7 @@ public class JU_AES {
byte[] encrypted = aes.encrypt(orig.getBytes());
byte[] decrypted = aes.decrypt(encrypted);
assertThat(new String(decrypted), is(orig));
-
+
Field aeskeySpec_field = AES.class.getDeclaredField("aeskeySpec");
aeskeySpec_field.setAccessible(true);
aeskeySpec_field.set(aes, null);
@@ -122,7 +122,7 @@ public class JU_AES {
CipherInputStream cisEncrypt;
CipherInputStream cisDecrypt;
-
+
// Test CipherInputStream
baisEncrypt = new ByteArrayInputStream(orig.getBytes());
cisEncrypt = aes.inputStream(baisEncrypt, true);
@@ -157,7 +157,7 @@ public class JU_AES {
CipherOutputStream cosEncrypt;
CipherOutputStream cosDecrypt;
-
+
// Test CipherOutputStream
baisEncrypt = new ByteArrayInputStream(orig.getBytes());
baosEncrypt = new ByteArrayOutputStream();
@@ -191,5 +191,5 @@ public class JU_AES {
os.write(buffer, 0, len);
}
}
-
+
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_BufferedCadiWrap.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_BufferedCadiWrap.java
index 2146205a..b0c0dca7 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_BufferedCadiWrap.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_BufferedCadiWrap.java
@@ -31,7 +31,7 @@ import org.mockito.MockitoAnnotations;
public class JU_BufferedCadiWrap {
@Mock
private HttpServletRequest request;
-
+
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiException.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiException.java
index 294bb867..2aff33de 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiException.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiException.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,7 +33,7 @@ public class JU_CadiException {
@Test
public void testCadiException() {
CadiException exception = new CadiException();
-
+
assertNotNull(exception);
}
@@ -58,11 +58,11 @@ public class JU_CadiException {
assertThat(exception.getMessage(), is("New Exception"));
}
-
+
@Test
public void testCadiException1() {
CadiException exception = new CadiException();
-
+
assertNotNull(exception);
}
@@ -87,11 +87,11 @@ public class JU_CadiException {
assertThat(exception.getMessage(), is("New Exception"));
}
-
+
@Test
public void testCadiException2() {
CadiException exception = new CadiException();
-
+
assertNotNull(exception);
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiWrap.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiWrap.java
index 4f31a8f4..5f97481f 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiWrap.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiWrap.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,13 +52,13 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
import org.onap.aaf.cadi.taf.TafResp;
public class JU_CadiWrap {
-
+
@Mock
private HttpServletRequest request;
-
+
@Mock
private TafResp tafResp;
-
+
@Mock
private TaggedPrincipal principle;
@@ -82,35 +82,35 @@ public class JU_CadiWrap {
public void testInstantiate() throws CadiException {
Access a = new PropAccess();
when(tafResp.getAccess()).thenReturn(a);
-
+
lur.fishAll(isA(Principal.class), (List<Permission>)isA(List.class));
-
+
EpiLur lur1 = new EpiLur(lur);
-
+
CadiWrap wrap = new CadiWrap(request, tafResp, lur1);
-
+
assertNull(wrap.getUserPrincipal());
assertNull(wrap.getRemoteUser());
assertNull(wrap.getUser());
assertEquals(wrap.getPermissions(principle).size(), 0);
assertTrue(wrap.access() instanceof PropAccess);
-
+
byte[] arr = {'1','2'};
wrap.setCred(arr);
-
+
assertEquals(arr, wrap.getCred());
-
+
wrap.setUser("User1");
assertEquals("User1", wrap.getUser());
-
+
wrap.invalidate("1");
assertFalse(wrap.isUserInRole(null));
-
+
wrap.set(tafResp, lur);
-
+
wrap.invalidate("2");
-
+
assertFalse(wrap.isUserInRole("User1"));
}
@@ -119,7 +119,7 @@ public class JU_CadiWrap {
Access a = new PropAccess();
when(tafResp.getAccess()).thenReturn(a);
when(tafResp.getPrincipal()).thenReturn(principle);
-
+
// Anonymous object for testing purposes
CachingLur<Permission> lur1 = new CachingLur<Permission>() {
@Override public Permission createPerm(String p) { return null; }
@@ -133,29 +133,29 @@ public class JU_CadiWrap {
@Override public void setDebug(String commaDelimIDsOrNull) { }
@Override public void clear(Principal p, StringBuilder sb) { }
};
-
+
MapPermConverter pc = new MapPermConverter();
-
+
CadiWrap wrap = new CadiWrap(request, tafResp, lur1, pc);
-
+
assertNotNull(wrap.getUserPrincipal());
assertNull(wrap.getRemoteUser());
assertNull(wrap.getUser());
-
+
byte[] arr = {'1','2'};
wrap.setCred(arr);
-
+
assertEquals(arr, wrap.getCred());
-
+
wrap.setUser("User1");
assertEquals("User1", wrap.getUser());
-
+
wrap.invalidate("1");
wrap.setPermConverter(new MapPermConverter());
-
+
assertTrue(wrap.getLur() instanceof CachingLur);
assertTrue(wrap.isUserInRole("User1"));
-
+
wrap.set(tafResp, lur);
assertFalse(wrap.isUserInRole("Perm1"));
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Capacitor.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Capacitor.java
index 4c842915..f03f2b6e 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Capacitor.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Capacitor.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,7 +34,7 @@ import java.lang.reflect.*;
public class JU_Capacitor {
private Capacitor cap;
- public final static String TEST_DATA =
+ public final static String TEST_DATA =
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" +
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" +
@@ -122,7 +122,7 @@ public class JU_Capacitor {
for (int i = 0; i < c.length; i += read) {
read = cap.read(c, i, Math.min(3, c.length-i));
}
- assertEquals(b, new String(c));
+ assertEquals(b, new String(c));
}
@Test
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java
index 859f9a25..56b5538f 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java
@@ -82,7 +82,7 @@ public class JU_CmdLine {
fis.close();
}
}
-
+
@After
public void restoreStreams() throws IOException {
System.setOut(System.out);
@@ -189,7 +189,7 @@ public class JU_CmdLine {
CmdLine.main(new String[]{"passgen", String.valueOf(length)});
output = outContent.toString().trim();
assertThat(output.length(), is(length));
-
+
length = 5;
outContent.reset();
CmdLine.main(new String[]{"passgen", String.valueOf(length)});
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Hash.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Hash.java
index 86d647e3..05abc7ed 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Hash.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Hash.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -208,11 +208,11 @@ public class JU_Hash {
assertEquals(new String(new byte[] {(byte)0x0A, (byte)0xB0}), new String(output));
assertNull(Hash.fromHexNo0x("~~"));
}
-//
+//
// @Test
// public void aaf_941() throws Exception {
// // User notes: From reported error "aaf" not coded right
-//
-//
+//
+//
// }
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_LocatorException.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_LocatorException.java
index bf79d74d..aa52225e 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_LocatorException.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_LocatorException.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_PropAccess.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_PropAccess.java
index 9ab2c98d..abb3397b 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_PropAccess.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_PropAccess.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,10 +39,10 @@ import java.util.Properties;
@SuppressWarnings("unused")
public class JU_PropAccess {
- // Note: We can't actually get coverage of the protected constructor -
+ // Note: We can't actually get coverage of the protected constructor -
// that will be done later, when testing the child class "ServletContextAccess"
-
-
+
+
@Test
public void ConstructorTest() throws Exception {
PropAccess prop = new PropAccess();
@@ -82,7 +82,7 @@ public class JU_PropAccess {
ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
pa.load(bais);
}
-
+
@Test
public void specialConversionsTest() throws Exception {
// Coverage tests
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_ServletContextAccess.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_ServletContextAccess.java
index 104923c7..827a86ed 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_ServletContextAccess.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_ServletContextAccess.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,7 +50,7 @@ public class JU_ServletContextAccess {
private FilterConfig filter_mock;
Enumeration<String> enumeration;
-
+
private class CustomEnumeration implements Enumeration<String> {
private int idx = 0;
private final String[] elements = {"This", "is", "a", "test"};
@@ -70,7 +70,7 @@ public class JU_ServletContextAccess {
filter_mock = mock(FilterConfig.class);
when(filter_mock.getInitParameterNames()).thenReturn(enumeration);
}
-
+
@Test
public void logTest() throws Exception {
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Symm.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Symm.java
index 5e6f69b8..110f1034 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Symm.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Symm.java
@@ -107,7 +107,7 @@ public class JU_Symm {
String orig = "I'm a password, really";
String b64encrypted;
String output;
-
+
ByteArrayOutputStream baosEncrypt = new ByteArrayOutputStream();
Symm.base64.encode(orig, baosEncrypt);
b64encrypted = new String(baosEncrypt.toByteArray());
@@ -126,7 +126,7 @@ public class JU_Symm {
String output;
byte[] prefix = "enc:".getBytes();
-
+
ByteArrayInputStream baisEncrypt = new ByteArrayInputStream(orig.getBytes());
ByteArrayOutputStream baosEncrypt = new ByteArrayOutputStream();
Symm.base64.encode(baisEncrypt, baosEncrypt, prefix);
@@ -209,5 +209,5 @@ public class JU_Symm {
assertTrue(e.getMessage().contains(" does not exist!"));
}
}
-
+
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_User.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_User.java
index 3df12f80..2bb9882f 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_User.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_User.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -55,16 +55,16 @@ public class JU_User {
@Mock
private Principal principal;
-
+
@Mock
private LocalPermission permission;
@Mock
private LocalPermission permission2;
-
+
@Before
public void setup() throws NoSuchFieldException, SecurityException {
MockitoAnnotations.initMocks(this);
-
+
when(principal.getName()).thenReturn("Principal");
when(permission.getKey()).thenReturn("NewKey");
@@ -98,7 +98,7 @@ public class JU_User {
assertThat((int)count_field.get(user), is(0));
assertThat(user.getCred(), is(cred.getBytes()));
}
-
+
@Test
public void constructorPrincipalIntervalTest() throws IllegalArgumentException, IllegalAccessException {
User<Permission> user = new User<Permission>(principal, 61 * SECOND);
@@ -133,7 +133,7 @@ public class JU_User {
user.resetCount();
assertThat((int)count_field.get(user), is(0));
}
-
+
@Test
public void permTest() throws InterruptedException, IllegalArgumentException, IllegalAccessException {
User<Permission> user = new User<Permission>(principal);
@@ -155,32 +155,32 @@ public class JU_User {
assertTrue(user.permsUnloaded());
assertTrue(user.noPerms());
}
-
+
@Test
public void addValuesToNewMapTest() {
User<Permission> user = new User<Permission>(principal);
Map<String, Permission> newMap = new HashMap<>();
-
+
assertFalse(user.contains(permission));
-
+
user.add(newMap, permission);
user.setMap(newMap);
-
+
assertTrue(user.contains(permission));
-
+
List<Permission> sink = new ArrayList<>();
user.copyPermsTo(sink);
-
+
assertThat(sink.size(), is(1));
assertTrue(sink.contains(permission));
-
+
assertThat(user.toString(), is("Principal|:NewKey"));
user.add(newMap, permission2);
user.setMap(newMap);
assertFalse(user.contains(permission2));
-
+
assertThat(user.toString(), is("Principal|:NewKey2,NewKey"));
}
-
+
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_CSV.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_CSV.java
index d4feac6f..1681f435 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_CSV.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_CSV.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,7 +52,7 @@ public class JU_CSV {
filename = "Sample.csv";
file = new File(filename);
}
-
+
@After
public void end() {
if(file!=null) {
@@ -64,7 +64,7 @@ public class JU_CSV {
public static void before() {
expected = new ArrayList<>();
}
-
+
@Test
public void test() throws IOException, CadiException {
Access access = new PropAccess();
@@ -78,7 +78,7 @@ public class JU_CSV {
} catch(IOException e) {
Assert.assertTrue("CSV correctly created exception",true);
}
-
+
Writer writer = csv.writer();
try {
writer.row(add("\"hello\""));
@@ -89,7 +89,7 @@ public class JU_CSV {
} finally {
writer.close();
}
-
+
PrintStream garbage = new PrintStream(new FileOutputStream(file, true));
try {
garbage.println("# Ignore empty spaces, etc");
@@ -100,8 +100,8 @@ public class JU_CSV {
garbage.close();
}
-
- ////////////
+
+ ////////////
// Tests
////////////
final Holder<Integer> hi = new Holder<>(0);
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Chmod.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Chmod.java
index 6e93cc53..148f2e5c 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Chmod.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Chmod.java
@@ -6,9 +6,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_FQI.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_FQI.java
index 3daa6cb7..30a5f65c 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_FQI.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_FQI.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_JsonOutputStream.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_JsonOutputStream.java
index b3d7797c..2203b07f 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_JsonOutputStream.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_JsonOutputStream.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_MaskFormatException.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_MaskFormatException.java
index ba03b6b1..41ca0715 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_MaskFormatException.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_MaskFormatException.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_NetMask.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_NetMask.java
index b37d03ae..3676e12e 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_NetMask.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_NetMask.java
@@ -6,9 +6,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,25 +39,25 @@ public class JU_NetMask {
String test = "1.2.3.4";
assertEquals(NetMask.derive(test.getBytes()), 0);
}
-
+
@Test
public void deriveTest3() {
String test = "1.2.4";
assertEquals(NetMask.derive(test.getBytes()), 0);
}
-
+
@Test
public void deriveTest4() {
String test = "1.3.4";
assertEquals(NetMask.derive(test.getBytes()), 0);
}
-
+
@Test
public void deriveTest5() {
String test = "2.3.4";
assertEquals(NetMask.derive(test.getBytes()), 0);
}
-
+
@Test
public void deriveTest6() {
String test = "3.4";
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java
index e4f1e013..230c6b3b 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java
@@ -6,9 +6,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Split.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Split.java
index cbaa545b..fb2ed0ed 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Split.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Split.java
@@ -6,9 +6,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -104,7 +104,7 @@ public class JU_Split {
assertThat(Split.splitTrim('c', null, 0).length, is(0));
}
-
+
@Test
public void coverageTest() {
@SuppressWarnings("unused")
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_SubStandardConsole.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_SubStandardConsole.java
index cff4b414..8c1597c0 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_SubStandardConsole.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_SubStandardConsole.java
@@ -6,9 +6,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_TheConsole.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_TheConsole.java
index da131255..ad63d5ad 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_TheConsole.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_TheConsole.java
@@ -6,9 +6,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java
index f9c4cf73..0ddbb479 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java
@@ -6,9 +6,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,7 +30,7 @@ import org.junit.Test;
import org.onap.aaf.cadi.util.Vars;
public class JU_Vars {
-
+
@Test
public void coverage() {
@SuppressWarnings("unused")
@@ -70,7 +70,7 @@ public class JU_Vars {
assertEquals(str,Vars.convert(holder,bstr="set %s to %s", "a","b"));
assertEquals("set a to b",holder.toString());
assertEquals(str,Vars.convert(null,bstr, "a","b"));
-
+
holder.setLength(0);
assertEquals(str = "%1=%2",Vars.convert(holder,str, "a","b"));
assertEquals("a=b",holder.toString());
@@ -79,7 +79,7 @@ public class JU_Vars {
assertEquals(str,Vars.convert(holder,bstr="%s=%s", "a","b"));
assertEquals("a=b",holder.toString());
assertEquals(str,Vars.convert(null,bstr, "a","b"));
-
+
holder.setLength(0);
assertEquals(str = "%1%2",Vars.convert(holder,str, "a","b"));
assertEquals("ab",holder.toString());
@@ -107,7 +107,7 @@ public class JU_Vars {
assertEquals(str=" %1%2%3 ",Vars.convert(holder,bstr = " %s%s%s ", "a","b","c","d","e","f","g","h","i","j"));
assertEquals(" abc ",holder.toString());
assertEquals(str,Vars.convert(null,bstr, "a","b","c","d","e","f","g","h","i","j"));
-
+
holder.setLength(0);
assertEquals(str = "set %1 to %2",Vars.convert(holder,str, "Something much","larger"));
@@ -122,8 +122,8 @@ public class JU_Vars {
assertEquals(str = "Text without Vars",Vars.convert(holder,str));
assertEquals(str,holder.toString());
assertEquals(str = "Text without Vars",Vars.convert(null,str));
-
-
+
+
holder.setLength(0);
assertEquals(str = "Not %1 Enough %2 Vars %3",Vars.convert(holder,str, "a","b"));
assertEquals("Not a Enough b Vars ",holder.toString());
@@ -143,7 +143,7 @@ public class JU_Vars {
str = "%1 !@#$%^*()-+?/,:;.";
assertEquals(str,Vars.convert(holder,bstr, "Not Acceptable"));
assertEquals("Not Acceptable !@#$%^*()-+?/,:;.",holder.toString());
- assertEquals(str ,Vars.convert(null,bstr, "Not Acceptable"));
+ assertEquals(str ,Vars.convert(null,bstr, "Not Acceptable"));
}
-
+
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_WSSEParser.java b/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_WSSEParser.java
index 5f880403..b9bd1268 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_WSSEParser.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_WSSEParser.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
-* *
+* *
* * http://www.apache.org/licenses/LICENSE-2.0
-* *
+* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,9 +37,9 @@ public class JU_WSSEParser {
// private String user;
// private byte[] password;
//
-// public void setUser(String user) { this.user = user; }
+// public void setUser(String user) { this.user = user; }
// public void setCred(byte[] passwd) { this.password = passwd; }
-// public String getUser() { return user; }
+// public String getUser() { return user; }
// public byte[] getCred() { return password; }
// };
@@ -58,7 +58,7 @@ public class JU_WSSEParser {
// System.out.println("CadiWrap credentials are: " + bc.getUser() + ", " + password);
// assertEquals("some_user", bc.getUser());
// assertEquals("some_password", password);
-//
+//
// } finally {
// fis.close();
// }
@@ -78,7 +78,7 @@ public class JU_WSSEParser {
// System.out.println("CadiWrap credentials are: " + bc.getUser() + ", " + password);
// assertEquals("none", bc.getUser());
// assertEquals("none", password);
-//
+//
// } finally {
// fis.close();
// }
@@ -121,8 +121,8 @@ public class JU_WSSEParser {
//
// e = wp.parse(bc, new ByteArrayInputStream("".getBytes())); // empty
// assertNotNull(e);
-//
-//
+//
+//
// long start, count = 0L;
// int iter = 30000;
// File f = new File("test/CBUSevent.xml");
@@ -146,9 +146,9 @@ public class JU_WSSEParser {
// }
// float ms = count/1000000f;
// System.out.println("Executed " + iter + " WSSE reads from Memory Stream in " + ms + "ms. " + ms/iter + "ms per trans");
-//
+//
// // SPECIFIC ISSUES
-//
+//
// fis = new FileInputStream("test/error2013_04_23.xml");
// try {
// bc.setCred(null);
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_XReader.java b/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_XReader.java
index 248f73b7..a88aecf5 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_XReader.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_XReader.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java
index 2a1ecdeb..6bdda4e0 100644
--- a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java
+++ b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,7 +41,7 @@ public class ClientFactory {
throw new CadiException(e);
}
}
-
+
public ClientFactory(String[] args) throws APIException, CadiException {
this(new PropAccess(args));
}
diff --git a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java
index 107e1d89..2b1003cb 100644
--- a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java
+++ b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,7 @@ import org.onap.aaf.cadi.client.Future;
public class RESTException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = -5232371598208651058L;
private Future<?> future;
@@ -32,11 +32,11 @@ public class RESTException extends Exception {
public RESTException(Future<?> future) {
this.future = future;
}
-
+
public int getCode() {
return future.code();
}
-
+
public String getMsg() {
return future.body();
}
@@ -61,6 +61,6 @@ public class RESTException extends Exception {
public String getLocalizedMessage() {
return errorString();
}
-
+
}
diff --git a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java
index c2deb458..3b7ab032 100644
--- a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java
+++ b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -56,18 +56,18 @@ public class SimpleRESTClient {
public String[] headers() {
return EMPTY;
}};
-
+
public SimpleRESTClient(final TokenClientFactory tcf, final String tokenURL, final String endpoint, final String[] scope) throws CadiException, LocatorException, APIException {
callTimeout = Integer.parseInt(tcf.access.getProperty(Config.AAF_CALL_TIMEOUT,Config.AAF_CALL_TIMEOUT_DEF));
tokenClient = tcf.newClient(tokenURL);
Result<TimedToken> rtt = tokenClient.getToken(scope);
if (rtt.isOK()) {
restClient = tcf.newTzClient(endpoint);
-
+
if ((client_id = tcf.access.getProperty(Config.AAF_APPID, null))==null) {
if ((client_id = tcf.access.getProperty(Config.CADI_ALIAS, null))==null) {
throw new CadiException(Config.AAF_APPID + " or " + Config.CADI_ALIAS + " needs to be defined");
- }
+ }
}
try {
restClient.setToken(client_id,rtt.value);
@@ -78,7 +78,7 @@ public class SimpleRESTClient {
throw new CadiException(rtt.error);
}
}
-
+
public SimpleRESTClient timeout(int newTimeout) {
callTimeout = newTimeout;
return this;
@@ -98,7 +98,7 @@ public class SimpleRESTClient {
}
return this;
}
-
+
/**
* Single Threaded Class for building up content
* @author Instrumental
@@ -109,24 +109,24 @@ public class SimpleRESTClient {
private String content;
private StringBuilder sb;
-
+
public Input() {
content = null;
sb = null;
}
-
+
public Input(final String content) {
this.content = content;
}
-
+
public void set(final String content) {
this.content = content;
}
-
+
public PrintWriter writer() {
return new PrintWriter(new StringBuilderWriter(builder()));
}
-
+
public StringBuilder builder() {
if (sb==null) {
sb = new StringBuilder();
@@ -134,7 +134,7 @@ public class SimpleRESTClient {
}
return sb;
}
-
+
/**
* Reuse StringBuilder object
*/
@@ -144,7 +144,7 @@ public class SimpleRESTClient {
sb.setLength(0);
}
}
-
+
@Override
public String toString() {
if (content!=null) {
@@ -162,7 +162,7 @@ public class SimpleRESTClient {
if (sb==null) {
rv = EMPTY_STREAM_BYTES;
} else {
- rv = sb.toString().getBytes();
+ rv = sb.toString().getBytes();
}
} else {
rv = content.getBytes();
@@ -173,7 +173,7 @@ public class SimpleRESTClient {
}
/////////////////////////////////////////////////////////////
- //
+ //
// CREATE
//
/////////////////////////////////////////////////////////////
@@ -194,11 +194,11 @@ public class SimpleRESTClient {
});
if (!future.get(callTimeout)) {
throw new RESTException(future);
- }
+ }
}
/////////////////////////////////////////////////////////////
- //
+ //
// READ
//
/////////////////////////////////////////////////////////////
@@ -221,11 +221,11 @@ public class SimpleRESTClient {
return future.value;
} else {
throw new RESTException(future);
- }
+ }
}
-
+
/////////////////////////////////////////////////////////////
- //
+ //
// UPDATE
//
/////////////////////////////////////////////////////////////
@@ -249,18 +249,18 @@ public class SimpleRESTClient {
return future.value;
} else {
throw new RESTException(future);
- }
+ }
}
/////////////////////////////////////////////////////////////
- //
+ //
// DELETE
//
/////////////////////////////////////////////////////////////
public void delete(final String path) throws RESTException, CadiException, LocatorException, APIException {
delete(path,APPLICATION_JSON);
}
-
+
public void delete(final String path, final String contentType) throws RESTException, CadiException, LocatorException, APIException {
Future<Void> future = restClient.best(new Retryable<Future<Void>>() {
@Override
@@ -270,17 +270,17 @@ public class SimpleRESTClient {
});
if (!future.get(callTimeout)) {
throw new RESTException(future);
- }
+ }
}
/////////////////////////////////////////////////////////////
-
+
private static class ETransfer implements EClient.Transfer {
private Input input;
public ETransfer(final Input input) {
this.input = input;
}
-
+
@Override
public void transfer(OutputStream os) throws IOException, APIException {
os.write(input.getBytes());
@@ -290,7 +290,7 @@ public class SimpleRESTClient {
public interface Headers {
String[] headers();
}
-
+
public String[] headers() {
if (chain==null) {
return headers.headers();
diff --git a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java
index d0c800bf..0dec0999 100644
--- a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java
+++ b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -56,14 +56,14 @@ public class OAuthExample {
public final static void main(final String args[]) {
// These Objects are expected to be Long-Lived... Construct once
-
+
// Property Access
- // This method will allow you to set "cadi_prop_files" (or any other property) on Command line
+ // This method will allow you to set "cadi_prop_files" (or any other property) on Command line
access = new PropAccess(args);
-
+
// access = PropAccess();
// Note: This style will load "cadi_prop_files" from VM Args
-
+
// Token aware Client Factory
try {
tcf = TokenClientFactory.instance(access);
@@ -71,8 +71,8 @@ public class OAuthExample {
access.log(e1, "Unable to setup OAuth Client Factory, Fail Fast");
System.exit(1);
}
-
-
+
+
// Obtain Endpoints for OAuth2 from Properties. Expected is "cadi.properties" file, pointed to by "cadi_prop_files"
try {
Map<String, String> aaf_urls = Agent.loadURLs(access);
@@ -81,9 +81,9 @@ public class OAuthExample {
String tokenIntrospectURL = access.getProperty(Config.AAF_OAUTH2_INTROSPECT_URL); // Default to AAF);
// Get Hello Service
final String endServicesURL = access.getProperty(Config.AAF_OAUTH2_HELLO_URL);
-
+
final int CALL_TIMEOUT = Integer.parseInt(access.getProperty(Config.AAF_CALL_TIMEOUT,Config.AAF_CALL_TIMEOUT_DEF));
-
+
//////////////////////////////////////////////////////////////////////
// Scenario 1:
// Get and use an OAuth Client, which understands Token Management
@@ -93,7 +93,7 @@ public class OAuthExample {
TokenClient tc = tcf.newClient(tokenServiceURL); // can set your own timeout here (url, timeoutMilliseconds)
// Set your Application (MicroService, whatever) Credentials here
- // These are how your Application is known, particularly to the OAuth Server.
+ // These are how your Application is known, particularly to the OAuth Server.
// If AAF Token server, then its just the same as your other AAF MechID creds
// If it is the Alternate OAUTH, you'll need THOSE credentials. See that tool's Onboarding procedures.
String client_id = access.getProperty(Config.AAF_APPID);
@@ -103,7 +103,7 @@ public class OAuthExample {
}
String client_secret = access.getProperty(Config.AAF_APPPASS);
tc.client_creds(client_id, client_secret);
-
+
// If you are working with Credentials the End User, set username/password as appropriate to the OAuth Server
// tc.password(end_user_id, end_user_password);
// IMPORTANT:
@@ -114,7 +114,7 @@ public class OAuthExample {
// With AAF, the Scopes you put in are the AAF Namespaces you want access to. Your Token will contain the
// AAF Permissions of the Namespaces (you can put in more than one), the user name (or client_id if no user_name),
// is allowed to see.
-
+
// Here's a trick to get the namespace out of a Fully Qualified AAF Identity (your MechID)
String ns = FQI.reverseDomain(client_id);
System.out.printf("\nNote: The AAF Namespace of FQI (Fully Qualified Identity) %s is %s\n\n",client_id, ns);
@@ -122,23 +122,23 @@ public class OAuthExample {
// Now, we can get a Token. Note: for "scope", use AAF Namespaces to get AAF Permissions embedded in
// Note: getToken checks if Token is expired, if so, then refreshes before handing back.
Result<TimedToken> rtt = tc.getToken(ns,"org.onap.test");
-
+
// Note: you can clear a Token's Disk/Memory presence by
// 1) removing the Token from the "token/outgoing" directory on the O/S
// 2) programmatically by calling "clearToken" with exact params as "getToken", when it has the same credentials set
// tc.clearToken("org.onap.aaf","org.onap.test");
-
+
// Result Object can be queried for success
if (rtt.isOK()) {
TimedToken token = rtt.value;
print(token); // Take a look at what's in a Token
-
+
// Use this Token in your client calls with "Tokenized Client" (TzClient)
// These should NOT be used cross thread.
TzClient helloClient = tcf.newTzClient(endServicesURL);
helloClient.setToken(client_id, token);
-
- // This client call style, "best" call with "Retryable" inner class covers finding an available Service
+
+ // This client call style, "best" call with "Retryable" inner class covers finding an available Service
// (when Multi-services exist) for the best service, based (currently) on distance.
//
// the "Generic" in Type gives a Return Value for the Code, which you can set on the "best" method
@@ -149,20 +149,20 @@ public class OAuthExample {
Future<String> future = client.read("hello","text/plain");
// The "future" calling method allows you to do other processing, such as call more than one backend
// client before picking up the result
- // If "get" matches the HTTP Code for the method (i.e. read HTTP Return value is 200), then
+ // If "get" matches the HTTP Code for the method (i.e. read HTTP Return value is 200), then
if (future.get(CALL_TIMEOUT)) {
// Client Returned expected value
return future.value;
} else {
throw new APIException(future.code() + future.body());
- }
+ }
}
});
-
+
// You want to do something with returned value. Here, we say "hello"
System.out.printf("\nPositive Response from Hello: %s\n",rv);
-
-
+
+
//////////////////////////////////////////////////////////////////////
// Scenario 2:
// As a Service, read Introspection information as proof of Authenticated Authorization
@@ -187,12 +187,12 @@ public class OAuthExample {
} else {
access.printf(Level.ERROR, "Unable to obtain OAuth Token: %d %s\n",rtt.code,rtt.error);
}
-
+
} catch (CadiException | LocatorException | APIException | IOException e) {
e.printStackTrace();
}
}
-
+
/////////////////////////////////////////////////////////////
// Examples of Object Access
/////////////////////////////////////////////////////////////
@@ -207,7 +207,7 @@ public class OAuthExample {
t.getScope(),
t.getRefreshToken());
}
-
+
private static void print(Introspect ti) {
if (ti==null || ti.getClientId()==null) {
System.out.println("Empty Introspect");
@@ -232,7 +232,7 @@ public class OAuthExample {
Chrono.timeStamp(exp),
ti.getScope(),
ti.getContent()==null?"":ti.getContent());
-
+
System.out.println();
}
diff --git a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java
index b8cce9e5..2d489f83 100644
--- a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java
+++ b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -56,25 +56,25 @@ public class OnapClientExample {
public final static void main(final String args[]) {
// These Objects are expected to be Long-Lived... Construct once
-
+
// Property Access
- // This method will allow you to set "cadi_prop_files" (or any other property) on Command line
+ // This method will allow you to set "cadi_prop_files" (or any other property) on Command line
access = new PropAccess(args);
// Note: This style will load "cadi_prop_files" from VM Args
// access = PropAccess();
try {
Map<String, String> aaf_urls = Agent.loadURLs(access);
Agent.fillMissing(access, aaf_urls);
-
+
// Token aware Client Factory
tcf = TokenClientFactory.instance(access);
} catch (APIException | GeneralSecurityException | IOException | CadiException e1) {
access.log(e1, "Unable to setup OAuth Client Factory, Fail Fast");
System.exit(1);
}
-
+
final int CALL_TIMEOUT = Integer.parseInt(access.getProperty(Config.AAF_CALL_TIMEOUT,Config.AAF_CALL_TIMEOUT_DEF));
-
+
try {
//////////////////////////////////////////////////////////////////////
// Scenario 1:
@@ -84,7 +84,7 @@ public class OnapClientExample {
// In this example, it is AAF, but it can be the Alternate OAuth
TokenClient tc = tcf.newClient(Config.AAF_OAUTH2_TOKEN_URL); // can set your own timeout here (url, timeoutMilliseconds)
-
+
// Here's a trick to get the namespace out of a Fully Qualified AAF Identity (your MechID)
String ns = FQI.reverseDomain(tc.client_id());
System.out.printf("\nNote: The AAF Namespace of FQI (Fully Qualified Identity) %s is %s\n\n",tc.client_id(), ns);
@@ -92,17 +92,17 @@ public class OnapClientExample {
// Now, we can get a Token. Note: for "scope", use AAF Namespaces to get AAF Permissions embedded in
// Note: getToken checks if Token is expired, if so, then refreshes before handing back.
Result<TimedToken> rtt = tc.getToken(ns,"org.onap.test"); // get multiple scopes
-
+
// Note: you can clear a Token's Disk/Memory presence by
// 1) removing the Token from the "token/outgoing" directory on the O/S
// 2) programmatically by calling "clearToken" with exact params as "getToken", when it has the same credentials set
// tc.clearToken("org.onap.aaf","org.onap.test");
-
+
// Result Object can be queried for success
if (rtt.isOK()) {
TimedToken token = rtt.value;
print(token); // Take a look at what's in a Token
-
+
// Use this Token in your client calls with "Tokenized Client" (TzClient)
// These should NOT be used cross thread.
// Get Hello Service URL... roll your own in your own world.
@@ -111,8 +111,8 @@ public class OnapClientExample {
TzClient helloClient = tcf.newTzClient(endServicesURL);
helloClient.setToken(tc.client_id(), token);
-
- // This client call style, "best" call with "Retryable" inner class covers finding an available Service
+
+ // This client call style, "best" call with "Retryable" inner class covers finding an available Service
// (when Multi-services exist) for the best service, based (currently) on distance.
//
// the "Generic" in Type gives a Return Value for the Code, which you can set on the "best" method
@@ -123,20 +123,20 @@ public class OnapClientExample {
Future<String> future = client.read("hello","text/plain");
// The "future" calling method allows you to do other processing, such as call more than one backend
// client before picking up the result
- // If "get" matches the HTTP Code for the method (i.e. read HTTP Return value is 200), then
+ // If "get" matches the HTTP Code for the method (i.e. read HTTP Return value is 200), then
if (future.get(CALL_TIMEOUT)) {
// Client Returned expected value
return future.value;
} else {
throw new APIException(future.code() + future.body());
- }
+ }
}
});
-
+
// You want to do something with returned value. Here, we say "hello"
System.out.printf("\nPositive Response from Hello: %s\n",rv);
-
-
+
+
//////////////////////////////////////////////////////////////////////
// Scenario 2:
// As a Service, read Introspection information as proof of Authenticated Authorization
@@ -160,12 +160,12 @@ public class OnapClientExample {
} else {
access.printf(Level.ERROR, "Unable to obtain OAuth Token: %d %s\n",rtt.code,rtt.error);
}
-
+
} catch (CadiException | LocatorException | APIException | IOException e) {
e.printStackTrace();
}
}
-
+
/////////////////////////////////////////////////////////////
// Examples of Object Access
/////////////////////////////////////////////////////////////
@@ -180,7 +180,7 @@ public class OnapClientExample {
t.getScope(),
t.getRefreshToken());
}
-
+
private static void print(Introspect ti) {
if (ti==null || ti.getClientId()==null) {
System.out.println("Empty Introspect");
@@ -205,7 +205,7 @@ public class OnapClientExample {
Chrono.timeStamp(exp),
ti.getScope(),
ti.getContent()==null?"":ti.getContent());
-
+
System.out.println();
}
diff --git a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java
index dc1824fc..c15e434d 100644
--- a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java
+++ b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,29 +39,29 @@ public class SimpleRestClientExample {
try {
// Note: Expect ClientFactory to be long-lived... do NOT create more than once.
ClientFactory cf = new ClientFactory(args);
-
-
+
+
String urlString = cf.getAccess().getProperty("myurl", null);
if (urlString==null) {
System.out.println("Note: In your startup, add \"myurl=https://<aaf hello machine>:8130\" to command line\n\t"
- + "OR\n\t"
+ + "OR\n\t"
+ " add -Dmyurl=https://<aaf hello machine>:8130 to VM Args\n\t"
+ "where \"aaf hello machine\" is an aaf Installation you know about.");
} else {
-
+
SimpleRESTClient restClient = cf.simpleRESTClient(urlString,"org.osaaf.aaf");
/////////////////////////////////////////////////////////////
- //
+ //
// Creating Content for CREATE/UPDATE
//
/////////////////////////////////////////////////////////////
// Create an object that can be reusable IN THIS THREAD ONLY... Not Thread-safe on purpose
Input input = new SimpleRESTClient.Input();
-
+
// Note: alternate use is to set the input object to an already created String
// Input input = new SimpleRESTClient.Input(aString);
-
+
PrintWriter pw = input.writer();
pw.print("{\"something\": [");
for (int i=0;i<4;++i) {
@@ -73,16 +73,16 @@ public class SimpleRestClientExample {
pw.print('}');
}
pw.println("]}");
-
+
// You can check or log the content
String content = input.toString();
System.out.println(content);
-
- // Good form for Writers is that you should close it...
+
+ // Good form for Writers is that you should close it...
pw.close();
/////////////////////////////////////////////////////////////
- //
+ //
// CREATE/POST
//
/////////////////////////////////////////////////////////////
@@ -100,7 +100,7 @@ public class SimpleRestClientExample {
/////////////////////////////////////////////////////////////
- //
+ //
// READ/GET
//
/////////////////////////////////////////////////////////////
@@ -110,24 +110,24 @@ public class SimpleRestClientExample {
System.out.println("-------- START REST READ/GET --------");
boolean expectException = false;
try {
-
+
// Call with no Queries
String rv = restClient.get("resthello/rest_id");
System.out.println(rv);
-
+
// Same call with "read" style
rv = restClient.read("resthello/rest_id");
System.out.println(rv);
-
-
+
+
// Call with Queries
rv = restClient.get("resthello/rest_id?perm=org.osaaf.people|*|read");
System.out.println(rv);
-
+
// Call setting ID from principal coming from Trans
// Pretend Transaction
HRequest req = new HRequest("demo@people.osaaf.org"); // Pretend Trans has Jonathan as Identity
-
+
// Call with RESTException, which allows obtaining HTTPCode and any Error message sent
rv = restClient.endUser(req.userPrincipal()).get("resthello/rest_id?perm=org.osaaf.people|*|read");
System.out.println(rv);
@@ -150,17 +150,17 @@ public class SimpleRestClientExample {
}
/////////////////////////////////////////////////////////////
- //
+ //
// UPDATE/PUT
//
/////////////////////////////////////////////////////////////
-
+
// If you use "input" object again as a writer, you can clear it on the same thread, and go again
input.clear();
// Here we just set to a String, instead of Writing
input.set("{\"something\" : []}");
-
+
System.out.println("-------- END REST UPDATE/PUT --------");
try {
String rv = restClient.update("resthello/rest_id", input);
@@ -175,7 +175,7 @@ public class SimpleRestClientExample {
}
/////////////////////////////////////////////////////////////
- //
+ //
// DELETE
//
/////////////////////////////////////////////////////////////
@@ -191,14 +191,14 @@ public class SimpleRestClientExample {
} finally {
System.out.println("-------- END REST DELETE --------");
}
- }
+ }
} catch (CadiException | APIException e) {
e.printStackTrace();
}
}
-
- private static class HRequest {
-
+
+ private static class HRequest {
+
public HRequest(String fqi) {
name = fqi;
}
@@ -212,7 +212,7 @@ public class SimpleRestClientExample {
public String getName() {
return name;
}
-
+
};
}
}
diff --git a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/MyServlet.java b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/MyServlet.java
index adb95d9b..8c3a1336 100644
--- a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/MyServlet.java
+++ b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/MyServlet.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,15 +40,15 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
// @RolesAllowed({"com.att.aaf.myPerm|myInstance|myAction"})
public class MyServlet implements Servlet {
private ServletConfig servletConfig;
-
+
public void init(ServletConfig config) throws ServletException {
servletConfig = config;
}
-
+
public ServletConfig getServletConfig() {
return servletConfig;
}
-
+
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
HttpServletRequest request;
try {
@@ -56,27 +56,27 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
} catch (ClassCastException e) {
throw new ServletException("Only serving HTTP today",e);
}
-
+
res.getOutputStream().println("<html><header><title>CSP Servlet Test</title></header><body><h1>You're good to go!</h1><pre>" +
request.getUserPrincipal());
-
+
String perm = request.getParameter("PERM");
if (perm!=null) {
if (request.isUserInRole(perm)) {
- if (perm.indexOf('|')<0) {
+ if (perm.indexOf('|')<0) {
res.getOutputStream().println("\nCongrats!, You are in Role " + perm);
- } else {
+ } else {
res.getOutputStream().println("\nCongrats!, You have Permission " + perm);
}
} else {
- if (perm.indexOf('|')<0) {
+ if (perm.indexOf('|')<0) {
res.getOutputStream().println("\nSorry, you are NOT in Role " + perm);
} else {
res.getOutputStream().println("\nSorry, you do NOT have Permission " + perm);
}
}
}
-
+
// You can get the working AAFCon from Trans
AAFCon<?> aafcon = AAFCon.obtain(req);
if (aafcon!=null) {
@@ -115,13 +115,13 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
res.getOutputStream().println("No AAFCon instantiated");
}
res.getOutputStream().print("</pre></body></html>");
-
+
}
-
+
public String getServletInfo() {
return "MyServlet";
}
-
+
public void destroy() {
}
} \ No newline at end of file
diff --git a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/Config.java b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/Config.java
index a45725d7..9f1c450f 100644
--- a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/Config.java
+++ b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/Config.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,13 +33,13 @@ import org.onap.aaf.cadi.filter.CadiFilter;
public class Config {
/**
* Method to make jetty configurations (others?) with more complex function possible
- *
+ *
* @param sc
*/
public static final void addToContext(WebAppContext sc, String propFile) {
sc.addFilter(CadiFilter.class,"/*",EnumSet.of(DispatcherType.REQUEST));
sc.setInitParameter(org.onap.aaf.cadi.config.Config.CADI_PROP_FILES, propFile);
}
-
+
}
diff --git a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyServletServer.java b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyServletServer.java
index 165acffb..4800e133 100644
--- a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyServletServer.java
+++ b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyServletServer.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,7 +43,7 @@ import org.onap.aaf.cadi.config.SecurityInfo;
import org.onap.aaf.cadi.filter.CadiFilter;
public abstract class JettyServletServer implements Servlet {
-
+
public static Server run(PropAccess access, String context, Class<? extends Servlet> servletCls, int port, String ...args) throws Exception {
// Defaults:
int blockingQueueSize = 10;
@@ -54,12 +54,12 @@ public abstract class JettyServletServer implements Servlet {
if (hostname==null) {
hostname = Inet4Address.getLocalHost().getHostName();
}
-
+
// Add your own Properties to override defaults
ArrayBlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(blockingQueueSize);
QueuedThreadPool pool = new QueuedThreadPool(maxPoolSize,corePoolSize,keepAliveTime,queue);
- Server server = new Server(pool);
+ Server server = new Server(pool);
String protocol;
if (access.getProperty(Config.CADI_KEYSTORE_PASSWORD,null)==null) {
@@ -74,26 +74,26 @@ public abstract class JettyServletServer implements Servlet {
SslContextFactory scf = new SslContextFactory();
scf.setSslContext(securityInfo.getSSLContext());
scf.setWantClientAuth(true);
- ServerConnector sslConnector = new ServerConnector(server,scf);
+ ServerConnector sslConnector = new ServerConnector(server,scf);
sslConnector.setHost(hostname);
sslConnector.setPort(port);
server.addConnector(sslConnector);
protocol = "https";
}
-
+
// Setup Sample Servlet
CadiFilter cf = new CadiFilter(true,access);
FilterHolder cfh = new FilterHolder(cf);
-
+
ServletHandler shand = new ServletHandler();
shand.addFilterWithMapping(cfh, "/*", FilterMapping.ALL);
// To use normal Servlets, just add the class here... Actually, bug in Jetty... need to add with ServletHolder
ServletHolder sh = new ServletHolder();
sh.setServlet(servletCls.newInstance());
shand.addServletWithMapping(sh,"/*");
-
+
// To use JASPI Authorization Style to protect the servlet, wrap the Servlet
- // with the "MiniJSAPIWrap class, as shown here. Then add "@RolesAllowed" on your
+ // with the "MiniJSAPIWrap class, as shown here. Then add "@RolesAllowed" on your
// servlet (see sample). Use Pipe delimited Permissions, not AAF Roles in the line
// shand.addServletWithMapping(new MiniJASPIWrap(MyServlet.class),"/*");
// call initialize after start
@@ -104,7 +104,7 @@ public abstract class JettyServletServer implements Servlet {
// Startup the Server
server.setStopAtShutdown(true);
server.start();
-
+
access.log(Level.INFO,"TestServlet is running at " + protocol + "://"+hostname+':'+port+context);
return server;
}
diff --git a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyStandalone.java b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyStandalone.java
index 6edd6f5b..81b8f20b 100644
--- a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyStandalone.java
+++ b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyStandalone.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,7 +40,7 @@ public class JettyStandalone {
} finally {
access.log(Level.INFO,"Stopping Service");
}
-
- }
+
+ }
}
diff --git a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/MiniJASPIWrap.java b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/MiniJASPIWrap.java
index 4d170f3f..2d34fa4c 100644
--- a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/MiniJASPIWrap.java
+++ b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/MiniJASPIWrap.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,11 +39,11 @@ import org.onap.aaf.cadi.filter.RolesAllowed;
/**
* MiniJASPIWrap
- *
+ *
* Support the ability to check JASPI Annotation Style Authorizations.
- *
+ *
* This can be a clean way to enforce API Authorization without mistakes in code.
- *
+ *
* @author JonathanGathman
*
*/
@@ -67,9 +67,9 @@ public class MiniJASPIWrap extends ServletHolder {
/**
* handle
- *
+ *
* When utilized, this class authorizes the transaction by first calling the standard J2EE API call
- * "isUserInRole" with the role(s) found in the class Annotations (JASPI Style)
+ * "isUserInRole" with the role(s) found in the class Annotations (JASPI Style)
*/
@Override
public void handle(Request baseRequest, ServletRequest request, ServletResponse response) throws ServletException, UnavailableException, IOException {
@@ -77,7 +77,7 @@ public class MiniJASPIWrap extends ServletHolder {
super.handle(baseRequest, request, response);
} else { // Validate
try {
-
+
HttpServletRequest hreq = (HttpServletRequest)request;
boolean proceed = false;
for (String role : rolesAllowed.value()) {
@@ -95,7 +95,7 @@ public class MiniJASPIWrap extends ServletHolder {
} catch (ClassCastException e) {
throw new ServletException("JASPIWrap only supports HTTPServletRequest/HttpServletResponse");
}
- }
+ }
}
}