-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMechanismAuthentication.java
More file actions
33 lines (27 loc) · 1.3 KB
/
MechanismAuthentication.java
File metadata and controls
33 lines (27 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//============================================================================
//
//The classes and/or objects participating in this Template Method pattern are:
//1. AbstractClass (AuthenticationMechanism)
// Defines abstract primitive operations that concrete subclasses
// define to implement steps of an algorithm implements a template
// method defining the skeleton of an algorithm. The template method
// calls primitive operations as well as operations defined in
// AbstractClass or those of other objects.
//2. ConcreteClass (LDAPAuth, KerberosAuth, LocalAuth)
// implements the primitive operations ot carry out subclass-specific
// steps of the algorithm
//============================================================================
// Selin Doğa Orhan
// Pluggable Authentication Mechanism
//This is the AbstractClass class.
abstract class AuthenticationMechanism {
protected abstract void prepareAuthenticating();
protected abstract int getuid(String name);
protected abstract int setuid(int uid);
protected abstract int authenticate (String name,String pwd);
// This is our template method.
public final int startAuthentication(String _name,String _pwd) {
prepareAuthenticating();
return authenticate(_name, _pwd);
}
}