class SimpleServiceIdentityProvider implements ServiceIdentityProvider {

    public Principal getIdentity(String domainName, String serviceName) {
        
        // all the role members in Athenz are normalized to lower case so we need to make
        // sure our principal's name and domain are created with lower case as well
        
        domainName = domainName.toLowerCase();
        serviceName = serviceName.toLowerCase();
        
        // make sure we're handling correct domain and service
        
        if (!domainName.equals(domain) || !serviceName.equals(service)) {
            return null;
        }
        
        PrincipalToken token = new PrincipalToken.Builder("S1", domainName, serviceName)
            .expirationWindow(tokenTimeout).host(host).keyId(keyId).build();
        token.sign(key);
        
        SimplePrincipal principal = (SimplePrincipal) SimplePrincipal.create(domainName,
                serviceName, token.getSignedToken(), System.currentTimeMillis() / 1000,
                authority);
        principal.setUnsignedCreds(token.getUnsignedToken());
        return principal;
    }

    public  SimpleServiceIdentityProvider(String domainName, String serviceName,
            PrivateKey privateKey, String keyId);
    public  SimpleServiceIdentityProvider(String domainName, String serviceName,
            PrivateKey privateKey, String keyId, long tokenTimeout);
    public  SimpleServiceIdentityProvider(Authority authority, String domainName,
            String serviceName, PrivateKey privateKey, String keyId, long tokenTimeout);

}