|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Realm
This interface must be implemented by any class that wants to implement a realm. A realm is an authentication and authorization mechanism used by the jiplet container. The jiplet container supports container managed authentication and authorization. That is the jiplet container can authenticate SIP end points sending SIP request messages before the message is delivered to the jiplet. That way, the jiplet do not have to implement its own authentication and authorization scheme. Instead, it can use the mechanism provided by the container.
When a SIP request message is received and a jiplet object is selected for delivery of the request, the container checks if the SIP end point needs to be authenticated. The jip.xml file included with every context specifies the authentication and authorization criteria for all the jiplets in the context. Some jiplets may not have any authentication and authorization criteria, but others may have it. If a jiplet requires authentication and authorization, the SIP end point has not been authenticated and the request message does not contain a Authorization header, the container responds to the request with a UNAUTHORIZED (401) response. If the end point has not been authenticated and an Authorization header is included in the request message for the realm, the realm specified by the jiplet is used to authenticate the user. The container calls the authenticate() method specified by this interface to authenticate. If the SIP end point cannot be authenticated, an UNAUTHORIZED (401) response is sent. If the user is successfully authenticated, the container checks if the user roles to determine if the SIP end-point has the required authorization. If the end point does not have the proper authorization, a FORBIDDEN (403) response is sent. Otherwise, the request is forwarded to the jiplet object.
The jiplet container supports "pluggable authentication modules" (not to be confused with PAM although some of the concepts are similar). That is, it is possible to plugin custom authentication and authorization modules into the jiplet container (configured in server.xml). The jiplet container already comes with a number of pre-defined custom realms but you can plug in your own custom module by creating a class that implements this interface. That way, you can integrate your organization's subscriber database into your jiplet application.
| Method Summary | |
|---|---|
boolean |
addUser(java.lang.String user,
java.lang.String password,
java.lang.String[] roles)
This method is used by management applications such as jiplet console to create a SIP end-point account. |
java.lang.String[] |
authenticate(java.lang.String method,
javax.sip.header.AuthorizationHeader header)
This method is called by the container to authentication a SIP end point. |
boolean |
deleteUser(java.lang.String user)
This method is used by management applications such as jiplet console to delete a SIP end-point account. |
void |
destroy()
This method is called by the container when the context is being removed. |
javax.sip.header.WWWAuthenticateHeader |
getAuthenticationHeader(Jiplet jiplet,
javax.sip.message.Message message,
java.lang.String headerType,
boolean stale)
When the jiplet container needs to send an UNAUTHORIZED response, it includes an Authenticate header. |
java.util.HashMap |
getParams()
Returns the init params passed to this object in the init() method. |
java.lang.String |
getRealmName()
|
java.lang.String[] |
getRoles(java.lang.String user)
Returns the roles specified for an user. |
void |
init(java.lang.String name,
java.io.File confDir,
java.util.HashMap params,
boolean defaultRealm)
This method is called by the container while initializing the realm. |
boolean |
isDefaultRealm()
|
boolean |
modifyUser(java.lang.String user,
java.lang.String password,
java.lang.String[] roles)
This method is used by management applications such as jiplet console to modify a SIP end-point account. |
boolean |
supportsProvisioning()
|
| Method Detail |
|---|
void init(java.lang.String name,
java.io.File confDir,
java.util.HashMap params,
boolean defaultRealm)
throws JipletException
name - name of the realm as configured in the server.xml.confDir - the full path name for the conf directory - where the jiplet
containerconfiguration is stored .params - init paramsdefaultRealm - true if the realm is the default realm.
JipletExceptionvoid destroy()
java.lang.String getRealmName()
java.lang.String[] authenticate(java.lang.String method,
javax.sip.header.AuthorizationHeader header)
method - The method field of the SIP request message.header - The parsed authorization header field received in the SIP message.
javax.sip.header.WWWAuthenticateHeader getAuthenticationHeader(Jiplet jiplet,
javax.sip.message.Message message,
java.lang.String headerType,
boolean stale)
jiplet - the jiplet object.message - the message that is being challenged.headerType - WWW-Authenticate or Proxy-Authenticatestale - true if the stale field should be set
boolean addUser(java.lang.String user,
java.lang.String password,
java.lang.String[] roles)
throws java.lang.UnsupportedOperationException
user - user namepassword - password for the userroles - authorization role for the user
java.lang.UnsupportedOperationException
boolean modifyUser(java.lang.String user,
java.lang.String password,
java.lang.String[] roles)
throws java.lang.UnsupportedOperationException
user - user name, must be an existing userpassword - password for the user, null if the password does not have to be changed.roles - authorization role for the user, null, if authorizations do not have to be modified.
java.lang.UnsupportedOperationException
boolean deleteUser(java.lang.String user)
throws java.lang.UnsupportedOperationException
user -
java.lang.UnsupportedOperationException
java.lang.String[] getRoles(java.lang.String user)
throws java.lang.UnsupportedOperationException
user -
java.lang.UnsupportedOperationExceptionboolean supportsProvisioning()
java.util.HashMap getParams()
boolean isDefaultRealm()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||