Skip to content

Instantly share code, notes, and snippets.

@luissilvazup
Last active June 17, 2020 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luissilvazup/8734c0f9ea445c97de0d3400042286d0 to your computer and use it in GitHub Desktop.
Save luissilvazup/8734c0f9ea445c97de0d3400042286d0 to your computer and use it in GitHub Desktop.
OCP Solution Part 1
public class O_OpenClosedSolution {
private interface Authentication {
boolean login(User user);
}
private static class AuthenticationLinkedin implements Authentication {
@Override
public boolean login(User user) {
//autêntica o login com o Oauth Linkedin.
}
}
private static class AuthenticationFacebook implements Authentication {
@Override
public boolean login(User user) {
//autêntica o login com o Oauth Facebook.
}
}
private static class AuthenticationDatabase implements Authentication {
@Override
public boolean login(User user) {
ConnectionDAO connectionDAO = new ConnectionDAO("root", "");
Connection connection = connectionDAO.createConnection();
//autêntica o login com informações do banco de dados
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment