mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-18 12:33:17 +08:00
Adding support for Meteor package prime8consulting:meteor-oauth2.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/// <reference path="meteor-prime8consulting-oauth2.d.ts" />
|
||||
|
||||
let str : string;
|
||||
str = oAuth2Server.pubSubNames.authCodes;
|
||||
str = oAuth2Server.pubSubNames.refreshTokens;
|
||||
|
||||
str = oAuth2Server.methodNames.authCodeGrant;
|
||||
|
||||
oAuth2Server.collections.refreshToken.find({});
|
||||
oAuth2Server.collections.authCode.find({});
|
||||
oAuth2Server.collections.accessToken.find({});
|
||||
oAuth2Server.collections.client.find({});
|
||||
|
||||
let obj = oAuth2Server.oauthserver;
|
||||
|
||||
oAuth2Server.subscribeTo.authCode();
|
||||
|
||||
oAuth2Server.callMethod.authCodeGrant(
|
||||
'client_id',
|
||||
'redirect_uri',
|
||||
'response_type',
|
||||
['scope1', 'scope'],
|
||||
'state',
|
||||
(err : Meteor.Error, result : OAuth2Server.AuthCodeGrantResult) => {
|
||||
|
||||
}
|
||||
);
|
||||
116
meteor-prime8consulting-oauth2/meteor-prime8consulting-oauth2.d.ts
vendored
Normal file
116
meteor-prime8consulting-oauth2/meteor-prime8consulting-oauth2.d.ts
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
// Type definitions for prime8consulting:meteor-oauth2
|
||||
// Project: https://github.com/prime-8-consulting/meteor-oauth2/
|
||||
// Definitions by: Robbie Van Gorkom <https://github.com/vangorra>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../meteor/meteor.d.ts" />
|
||||
|
||||
declare module OAuth2Server {
|
||||
interface RefreshToken {
|
||||
refreshToken : string;
|
||||
clientId : string;
|
||||
userId : string;
|
||||
expires : Date;
|
||||
}
|
||||
|
||||
interface AuthCode {
|
||||
authCode : string;
|
||||
clientId : string;
|
||||
userId : string;
|
||||
expires : Date;
|
||||
}
|
||||
|
||||
interface AccessToken {
|
||||
accessToken : string;
|
||||
clientId : string;
|
||||
userId : string;
|
||||
expires : Date
|
||||
}
|
||||
|
||||
interface Client {
|
||||
clientId : string;
|
||||
active : boolean;
|
||||
redirectUri : string;
|
||||
clientSecret : string;
|
||||
}
|
||||
|
||||
interface PubSubNames {
|
||||
/**
|
||||
* Constant string representing the auth codes pub/sub.
|
||||
*/
|
||||
authCodes : string;
|
||||
|
||||
/**
|
||||
* Constant string representing the refresh token pub/sub.
|
||||
*/
|
||||
refreshTokens : string;
|
||||
}
|
||||
|
||||
interface MethodNames {
|
||||
/**
|
||||
* Constant string representing th authCodeGran meteor method.
|
||||
*/
|
||||
authCodeGrant : string;
|
||||
}
|
||||
|
||||
interface Collections {
|
||||
/**
|
||||
* Collection of the refresh tokens.
|
||||
*/
|
||||
refreshToken : Mongo.Collection<RefreshToken>;
|
||||
|
||||
/**
|
||||
* Collection of the authorization codes.
|
||||
*/
|
||||
authCode : Mongo.Collection<AuthCode>;
|
||||
|
||||
/**
|
||||
* (server only) Collection of the access tokens.
|
||||
*/
|
||||
accessToken : Mongo.Collection<AccessToken>;
|
||||
|
||||
/**
|
||||
* (server only) Collection of the clients authorized to use the oauth2 service.
|
||||
*/
|
||||
client : Mongo.Collection<Client>;
|
||||
}
|
||||
|
||||
interface SubscribeTo {
|
||||
/**
|
||||
* Wrapper function to subscribe to the auth code subscription. Returns a standard subscription handle.
|
||||
*/
|
||||
authCode() : Meteor.SubscriptionHandle;
|
||||
}
|
||||
|
||||
interface AuthCodeGrantResult {
|
||||
success : boolean;
|
||||
error : any;
|
||||
authorizationCode : string;
|
||||
redirectToUri : string;
|
||||
}
|
||||
|
||||
interface CallMethod {
|
||||
/**
|
||||
* Wrapper for Meteor.method to create an authorization code. This is an async function and a callback must be provided to be of any use.
|
||||
*/
|
||||
authCodeGrant(
|
||||
client_id : string,
|
||||
redirect_uri : string,
|
||||
response_type : string,
|
||||
scope : string[],
|
||||
state : string,
|
||||
callback : (err : Meteor.Error, authCodeGrantResult : AuthCodeGrantResult) => void
|
||||
) : void;
|
||||
}
|
||||
|
||||
interface OAuth2Server {
|
||||
pubSubNames : PubSubNames;
|
||||
methodNames : MethodNames;
|
||||
collections : Collections;
|
||||
oauthserver : any;
|
||||
subscribeTo : SubscribeTo;
|
||||
callMethod : CallMethod;
|
||||
}
|
||||
}
|
||||
|
||||
declare var oAuth2Server : OAuth2Server.OAuth2Server;
|
||||
Reference in New Issue
Block a user