package com.atlassian.bitbucket.internal.ssh.server;

import com.atlassian.bitbucket.auth.SshAuthenticationContext;

import javax.annotation.Nonnull;
import java.security.PublicKey;

import static com.google.common.base.Preconditions.checkNotNull;

public class DefaultSshAuthenticationContext implements SshAuthenticationContext {

    private final SshCredentials credentials;

    public DefaultSshAuthenticationContext(SshCredentials credentials) {
        this.credentials = checkNotNull(credentials, "credentials");
    }

    @Nonnull
    @Override
    public String getUsername() {
        return credentials.getUsername();
    }

    @Nonnull
    @Override
    public PublicKey getPublicKey() {
        return credentials.getPublicKey();
    }
}
