@magda/authentication-plugin-sdk 2.0.0-alpha.0 → 2.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -81,12 +81,13 @@ export declare function createOrGetUserToken(
81
81
  ): Promise<UserToken>;
82
82
 
83
83
  /**
84
- * Join `url` with `baseUrl` if `url` is not an absolute url
84
+ * Join `url` with `baseUrl` if `url` is not an absolute (full) url string
85
85
  *
86
86
  * @export
87
- * @param {string} url
88
- * @param {string} baseUrl
87
+ * @param {string} url A full url string or a url path string (/a/b/c).
88
+ * @param {string} baseUrl A baseUrl used to generate a full url when a url path string is supplied via the `url` parameter.
89
89
  * @param {{ [key: string]: string }} [optionalQueries]
90
+ * @param {string[]} [allowedUrlHosts] Optional; when specify, the host of `url` parameter will only be used if it is included by this list.
90
91
  * @returns
91
92
  */
92
93
  export declare function getAbsoluteUrl(
@@ -94,7 +95,8 @@ export declare function getAbsoluteUrl(
94
95
  baseUrl: string,
95
96
  optionalQueries?: {
96
97
  [key: string]: string;
97
- }
98
+ },
99
+ allowedUrlHosts?: string[]
98
100
  ): string;
99
101
 
100
102
  export declare function redirectOnSuccess(
package/dist/index.d.ts CHANGED
@@ -129,18 +129,18 @@ export declare const destroySession: typeof destroySession_2;
129
129
  declare function destroySession_2(req: express.Request): Promise<void>;
130
130
 
131
131
  /**
132
- * Join `url` with `baseUrl` if `url` is not an absolute url
132
+ * Join `url` with `baseUrl` if `url` is not an absolute (full) url string
133
133
  *
134
134
  * @export
135
- * @param {string} url
136
- * @param {string} baseUrl
137
- * @param {{ [key: string]: any }} [optionalQueries] optional extra query parameters to add to the result url.
138
- * All values supplied will be converted into string before encoded into the url.
135
+ * @param {string} url A full url string or a url path string (/a/b/c).
136
+ * @param {string} baseUrl A baseUrl used to generate a full url when a url path string is supplied via the `url` parameter.
137
+ * @param {{ [key: string]: string }} [optionalQueries]
138
+ * @param {string[]} [allowedUrlHosts] Optional; when specify, the host of `url` parameter will only be used if it is included by this list.
139
139
  * @returns
140
140
  */
141
141
  export declare function getAbsoluteUrl(url: string, baseUrl: string, optionalQueries?: {
142
- [key: string]: any;
143
- }): string;
142
+ [key: string]: string;
143
+ }, allowedUrlHosts?: string[]): string;
144
144
 
145
145
  export declare function getSessionId(req: express.Request, secret?: string): string;
146
146