Skip to content

Commit

Permalink
Clean up docs + test
Browse files Browse the repository at this point in the history
  • Loading branch information
giriparus committed May 14, 2024
1 parent 2bbe9bb commit 8f19036
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
18 changes: 10 additions & 8 deletions oidc-consumer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ class OidcConsumer {
* @param response - Express response object
* @param next - Express next object
* @returns authCallback utility
* @throws 400 - Missing Callback URL
* @throws MISSING_DESTINATION
* @throws DISALLOWED_REDIRECT_URI
*/
#defaultAuthRedirect(request: Request, response: Response, _next: NextFunction) {
return this.authRedirect(request, response, _next, undefined);
Expand All @@ -100,7 +101,8 @@ class OidcConsumer {
* @param response - Express response object
* @param queryParams - Additional params to be passed in the redirect-url
* @returns void
* @throws Missing Callback URL
* @throws MISSING_DESTINATION
* @throws DISALLOWED_REDIRECT_URI
*/
async authRedirect(request: Request, response: Response, next: NextFunction, queryParams?: Object) {
const { redirectUri: destination } = request.query;
Expand Down Expand Up @@ -167,9 +169,9 @@ class OidcConsumer {
* @param response - Express response object
* @param next - Express next object
* @returns authCallback utility
* @throws Secret Mismatch
* @throws Missing Destination
* @throws Couldn't destroy session
* @throws SECRET_MISMATCH
* @throws MISSING_DESTINATION
* @throws FAILURE_DESTROYING_SESSION
*/
#defaultAuthCallback(request: Request, response: Response, next: NextFunction) {
return this.authCallback(request, response, next, undefined, undefined);
Expand All @@ -182,9 +184,9 @@ class OidcConsumer {
* @param next - Express next object
* @param queryParams - Additional params to be passed in the redirect-url
* @param [httpOptions] Optional http options passed through the underlying http library for auth-code and token exchange
* @throws Secret Mismatch
* @throws Missing Destination
* @throws Couldn't destroy session
* @throws SECRET_MISMATCH
* @throws MISSING_DESTINATION
* @throws FAILURE_DESTROYING_SESSION
*/

async authCallback(request: Request, response: Response, next: NextFunction, queryParams: Object, httpOptions?: WreckHttpOptions) {
Expand Down
11 changes: 0 additions & 11 deletions oidc-consumer/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,6 @@ const consumer = new OidcConsumer({
});

describe('Authentication Functions', () => {
let firestoreStub=sinon.SinonStub;

beforeEach(() => {
firestoreStub = sinon.stub(Firestore.prototype, 'collection').returnsThis();
firestoreStub.doc = sinon.stub().returnsThis();
firestoreStub.get = sinon.stub();
});

afterEach(() => {
firestoreStub.restore();
});

describe('verifySession', () => {
it('should call next() if session state is present', async () => {
Expand Down

0 comments on commit 8f19036

Please sign in to comment.