1 PACKAGE FND_HTTP_TICKET AUTHID CURRENT_USER AS
2 /* $Header: AFSTCKTS.pls 120.1 2005/07/02 04:18:33 appldev noship $ */
3 --
4 -- schema information
5 --
6 -- Table to store short-lifespan and one-time-use tickets.
7 -- Since the table is only accessed by TICKET, or by a full scan,
8 -- it's an index-organized table to reduce storage overhead.
9 --
10 -- create table FND_HTTP_TICKETS
11 -- (
12 -- TICKET raw(16) not null,
13 -- START_DATE date default SYSDATE not null,
14 -- END_DATE date ,
15 -- OPERATION varchar2(255) ,
16 -- ARGUMENT varchar2(4000) ,
17 -- constraint FND_HTTP_TICKETS_PK
18 -- primary key (TICKET)
19 -- ) organization index;
20 -- TICKET 16-byte raw value holding a 128-bit cryptographically secure
21 -- random number that will be used as the ticket value.
22 -- START_DATE The date/time that the ticket was generated (defaults to
23 -- SYSDATE).
24 -- END_DATE An optional date/time that the ticket will expire.
25 -- OPERATION A 255-byte string to hold as a payload an optional operation
26 -- that is correlated with the ticket (to prevent misuse of
27 -- the ticket for an operation other than that intended by the
28 -- issuer).
29 -- ARGUMENT A 4000-byte string to hold as a payload an optional argument
30 -- or arguments to the operation (to prevent misuse of the
31 -- ticket against a target object or parameters other than those
32 -- intended by the issuer.
33 --
34
35
36 --
37 -- Create a ticket for use with an HTTP operation. Optionally store
38 -- a string describing the operation (up to 255 bytes), and an argument
39 -- string (up to 4000 bytes). Optionally specify a lifespan for the
40 -- ticket (in seconds). Returns a 16-byte secure random raw value, or
41 -- null upon failure.
42 --
43 function CREATE_TICKET(P_OPERATION in varchar2 default null,
44 P_ARGUMENT in varchar2 default null,
45 P_LIFESPAN in number default 60)
46 return raw;
47 --
48 -- Version of create ticket that returns a URL-compatible string that
49 -- is equivalent to the raw value.
50 --
51 function CREATE_TICKET_STRING(P_OPERATION in varchar2 default null,
52 P_ARGUMENT in varchar2 default null,
53 P_LIFESPAN in number default 60)
54 return varchar2;
55 --
56 -- Set a ticket for use with an HTTP service. Updates the existing
57 -- row for this service with a new ticket value. Returns both the new
58 -- and the previous ticket values concatenated into a 32-byte raw.
59 -- Returns null on any failure.
60 --
61 function SET_SERVICE_TICKET(P_SERVICE in varchar2) return raw;
62 --
63 -- Gets the ticket for use with an HTTP service.
64 -- Returns a pair of 16-byte secure random raw values concatenated into
65 -- a 32-byte raw, or null upon failure. The first 16 bytes are the
66 -- current ticket value, and the last 16 bytes are the previous ticket
67 -- value.
68 --
69 function GET_SERVICE_TICKET(P_SERVICE in varchar2)
70 return raw;
71 --
72 -- Version of get service ticket that returns a URL-compatible string
73 -- that is equivalent to the raw value.
74 --
75 function GET_SERVICE_TICKET_STRING(P_SERVICE in varchar2)
76 return varchar2;
77 --
78 -- Compare two service ticket pairs.
79 -- Each ticket pair is passed as a 32-byte raw. If either 16-byte portion
80 -- of the first pair matches either 16-byte portion of the second pair,
81 -- returns true, otherwise returns false.
82 --
83 function COMPARE_SERVICE_TICKETS(P_TICKET1 in raw, P_TICKET2 in raw)
84 return boolean;
85 --
86 -- String form of ticket pair comparison.
87 -- Returns true for a match, false otherwise.
88 --
89 function COMPARE_SERVICE_TICKET_STRINGS(P_TICKET1 in varchar2,
90 P_TICKET2 in varchar2)
91 return boolean;
92 --
93 -- Check an HTTP ticket to see if its valid. If so, any stored
94 -- operation and/or argument string(s) are returned in the output
95 -- arguments. The returned value is null for a failure to find the
96 -- ticket, false if the ticket still exists but has expired, and true
97 -- otherwise (including the case where no lifespan was specified).
98 --
99 function CHECK_TICKET(P_TICKET in raw,
100 P_OPERATION out nocopy varchar2,
101 P_ARGUMENT out nocopy varchar2)
102 return boolean;
103 --
104 -- Simpler form of check that omits the output buffers.
105 --
106 function CHECK_TICKET(P_TICKET in raw) return boolean;
107 --
108 -- Version of check ticket that takes a URL string argument.
109 --
110 function CHECK_TICKET_STRING(P_TICKET in varchar2,
111 P_OPERATION out nocopy varchar2,
112 P_ARGUMENT out nocopy varchar2)
113 return boolean;
114 --
115 -- Simpler version of check ticket that takes a URL string argument.
116 --
117 function CHECK_TICKET_STRING(P_TICKET in varchar2) return boolean;
118 --
119 -- Update a ticket's payload columns,
120 -- return true if successful, false if expired
121 --
122 function UPDATE_TICKET(P_TICKET in raw,
123 P_OPERATION in varchar2,
124 P_ARGUMENT in varchar2)
125 return boolean;
126 --
127 -- Version of update ticket that takes a URL string ticker.
128 --
129 function UPDATE_TICKET_STRING(P_TICKET in varchar2,
130 P_OPERATION in varchar2,
131 P_ARGUMENT in varchar2)
132 return boolean;
133 --
134 -- Check a one-time-use ticket; destroys the ticket if found,
135 -- returns results as per CHECK_TICKET.
136 --
137 function CHECK_ONETIME_TICKET(P_TICKET in raw,
138 P_OPERATION out nocopy varchar2,
139 P_ARGUMENT out nocopy varchar2)
140 return boolean;
141 --
142 -- Version of the one-time-use ticket check that takes a URL string ticket.
143 --
144 function CHECK_ONETIME_TICKET_STRING(P_TICKET in varchar2,
145 P_OPERATION out nocopy varchar2,
146 P_ARGUMENT out nocopy varchar2)
147 return boolean;
148 --
149 -- Destroy an HTTP ticket, delete it from the table.
150 --
151 procedure DESTROY_TICKET(P_TICKET in raw);
152 --
153 -- Version of destroy ticket that takes a URL string.
154 --
155 procedure DESTROY_TICKET_STRING(P_TICKET in varchar2);
156 --
157 -- Remove all expired tickets from the table. Optionally can also
158 -- remove all tickets that have aged beyond the specified lifespan
159 -- (in seconds).
160 --
161 procedure PURGE_TICKETS(P_MAX_LIFESPAN in number default null);
162 --
163 end FND_HTTP_TICKET;