i-Planet Administration Guide

The java file for MyLogin Module

Missing Cross Reference Target contains a sample Java file for MyLogin Module.


package com.companyx.auth;

import com.sun.authd.*;

public class MyLogin extends Login {

	private String userTokenId;

	public MyLogin() throws LoginException{}

	public void init() throws LoginException {}

	public void validate() throws LoginException {

			String token = getToken();
			if (getCurrentState() == 1) {
				int ret = myAuthenticateId(token);
				if (ret == 0) {
						throw new LoginException("Invalid UserId: " + userTokenId);
		 		}
			}


			else {
		 	 	int ret = myAuthenticatePassword(token);
		 		if (ret == 0) {
						throw new LoginException("Invalid Password: " + userTokenId);
		   		}
		 		userTokenId = token;
			}

	}

	public String getUserTokenId() {
			return userTokenId;
	}

	public int myAuthenticateID(
			Sting userID
	)
	{
			return 1;
	}
	public int myAuthenticatePassword(
			String userId
	)
	{
			return 1;
	}

}

There is also a sample in /opt/SUNWstnr/sample/auth/com/sun/login that uses most of the methods in the Login class. There is also a javadoc in /opt/SUNWstnr/docs/javadocs/com/sun/authd for the Login class.