org.jwarp.service.security
Class Ticket
java.lang.Object
|
+--org.jwarp.service.security.Ticket
- All Implemented Interfaces:
- ITicket, java.io.Serializable
- public class Ticket
- extends java.lang.Object
- implements ITicket, java.io.Serializable
This is the central ticket interface. A ticket is returned by the security service
as service access unit. Tickets can expire after a while (e.g. for Administrator tickets).
Always they should expire after a certain time of no usage. There are also different
implementation location. A ticket can firstly directly denied by the target security service
or also can be denied by the ticket itself. The security class itself should check for
a different implementation class to prevent wrapping of the security ticket.
- See Also:
- Serialized Form
|
Constructor Summary |
Ticket(int user,
IContext context,
long magic,
int expireSeconds,
int extendExpireSecs)
|
|
Method Summary |
IContext |
getContext()
Return the context identifier. |
long |
getExpireTime()
Returns the expire time of the ticket or -1 if the ticket can not expire.
|
int |
getID()
Returns the user id of the user logged in. |
long |
getLoginDate()
Returns the creation time of this ticket. |
long |
getMagic()
Return a magic number. |
boolean |
hasExpired()
Return true if this ticket has expired. |
protected void |
logAccess()
|
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Ticket
public Ticket(int user,
IContext context,
long magic,
int expireSeconds,
int extendExpireSecs)
getLoginDate
public final long getLoginDate()
- Returns the creation time of this ticket.
- Specified by:
getLoginDate in interface ITicket
- Returns:
- The creation date
getExpireTime
public final long getExpireTime()
- Returns the expire time of the ticket or -1 if the ticket can not expire.
This expiry date can change depending no the actual actions and usage.
Corresponding new values must be set over the underlying implementation class.
- Specified by:
getExpireTime in interface ITicket
- Returns:
- The expiry date
hasExpired
public final boolean hasExpired()
- Return true if this ticket has expired.
- Specified by:
hasExpired in interface ITicket
- Returns:
- true if expired
getID
public final int getID()
- Returns the user id of the user logged in.
- Specified by:
getID in interface ITicket
- Returns:
- The user id
getContext
public final IContext getContext()
- Return the context identifier.
- Specified by:
getContext in interface ITicket
- Returns:
- The underlying service context's name
getMagic
public final long getMagic()
- Return a magic number. This number is used to control the access with
a ticket. New values must be set by the security system and can not be overridden.
- Specified by:
getMagic in interface ITicket
- Returns:
- The magic number of this ticket
logAccess
protected void logAccess()