@Test public void createPrincipal_OnlyAccessKeyGiven_ShouldCreateIamPrincipal() { GatewayRequest request = createRequestMock("accessKey", null, null, null); IamPrincipal principal = (IamPrincipal) createSecurityContextFactory(request).createPrincipal(); assertEquals("accessKey", principal.getAccessKey()); assertNull(principal.getUserArn()); assertNull(principal.getUser()); assertNull(principal.getCaller()); assertEquals(principal.getUserArn(), principal.getName()); }
@Override protected Principal createPrincipal() { GatewayIdentity identity = getIdentitySafe(); String userArn = identity.getUserArn(); String user = identity.getUser(); String accessKey = identity.getAccessKey(); String caller = identity.getCaller(); return new IamPrincipal() { @Override public String getUser() { return user; } @Override public String getUserArn() { return userArn; } @Override public String getAccessKey() { return accessKey; } @Override public String getCaller() { return caller; } }; }
IamSecurityContextFactory extends AbstractSecurityContextFactory { @Override protected Principal createPrincipal() { GatewayIdentity identity = getIdentitySafe(); String userArn = identity.getUserArn(); String user = identity.getUser(); String accessKey = identity.getAccessKey(); String caller = identity.getCaller(); return new IamPrincipal() { @Override public String getUser() { return user; } @Override public String getUserArn() { return userArn; } @Override public String getAccessKey() { return accessKey; } @Override public String getCaller() { return caller; } }; } }
IamSecurityContextFactory extends AbstractSecurityContextFactory { @Override protected Principal createPrincipal() { GatewayIdentity identity = getIdentitySafe(); String userArn = identity.getUserArn(); String user = identity.getUser(); String accessKey = identity.getAccessKey(); String caller = identity.getCaller(); return new IamPrincipal() { @Override public String getUser() { return user; } @Override public String getUserArn() { return userArn; } @Override public String getAccessKey() { return accessKey; } @Override public String getCaller() { return caller; } }; } protected  IamSecurityContextFactory(@Nonnull GatewayRequest request); }
IamSecurityContextFactory extends AbstractSecurityContextFactory { @Override protected Principal createPrincipal() { GatewayIdentity identity = getIdentitySafe(); String userArn = identity.getUserArn(); String user = identity.getUser(); String accessKey = identity.getAccessKey(); String caller = identity.getCaller(); return new IamPrincipal() { @Override public String getUser() { return user; } @Override public String getUserArn() { return userArn; } @Override public String getAccessKey() { return accessKey; } @Override public String getCaller() { return caller; } }; } protected  IamSecurityContextFactory(@Nonnull GatewayRequest request);  }
IamSecurityContextFactory extends AbstractSecurityContextFactory { @Override protected Principal createPrincipal() { GatewayIdentity identity = getIdentitySafe(); String userArn = identity.getUserArn(); String user = identity.getUser(); String accessKey = identity.getAccessKey(); String caller = identity.getCaller(); return new IamPrincipal() { @Override public String getUser() { return user; } @Override public String getUserArn() { return userArn; } @Override public String getAccessKey() { return accessKey; } @Override public String getCaller() { return caller; } }; } protected  IamSecurityContextFactory(@Nonnull GatewayRequest request);   }