Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

casdoor-js-sdk

Package Overview
Dependencies
Maintainers
5
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

casdoor-js-sdk - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

13

lib/cjs/index.js
"use strict";
// Copyright 2021 The casbin Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });
const sdk_1 = require("./sdk");
exports.default = sdk_1.default;

11

lib/cjs/sdk.d.ts

@@ -7,3 +7,3 @@ export interface sdkConfig {

}
export interface accountSession {
export interface account {
organization: string;

@@ -26,7 +26,8 @@ username: string;

constructor(config: sdkConfig);
getSignupUrl(): string;
getSigninUrl(redirectUri?: string): string;
getUserProfileUrl(userName: string, account: accountSession): string;
getMyProfileUrl(account: accountSession): string;
getSignupUrl(enablePassword?: boolean): string;
getSigninUrl(): string;
getUserProfileUrl(userName: string, account: account): string;
getMyProfileUrl(account: account): string;
signin(serverUrl: string): Promise<Response>;
}
export default Sdk;
"use strict";
// Copyright 2021 The casbin Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });

@@ -7,6 +20,12 @@ class Sdk {

}
getSignupUrl() {
return `${this.config.serverUrl.trim()}/signup/${this.config.appName}`;
getSignupUrl(enablePassword = true) {
if (enablePassword) {
return `${this.config.serverUrl.trim()}/signup/${this.config.appName}`;
}
else {
return this.getSigninUrl().replace("/login/oauth/authorize", "/signup/oauth/authorize");
}
}
getSigninUrl(redirectUri = `${window.location.origin}/callback`) {
getSigninUrl() {
const redirectUri = `${window.location.origin}/callback`;
const scope = "read";

@@ -30,3 +49,10 @@ const state = this.config.appName;

}
signin(serverUrl) {
const params = new URLSearchParams(window.location.search);
return fetch(`${serverUrl}/api/signin?code=${params.get("code")}&state=${params.get("state")}`, {
method: "POST",
credentials: "include",
}).then(res => res.json());
}
}
exports.default = Sdk;

@@ -0,2 +1,15 @@

// Copyright 2021 The casbin Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import sdk from './sdk';
export default sdk;

@@ -7,3 +7,3 @@ export interface sdkConfig {

}
export interface accountSession {
export interface account {
organization: string;

@@ -26,7 +26,8 @@ username: string;

constructor(config: sdkConfig);
getSignupUrl(): string;
getSigninUrl(redirectUri?: string): string;
getUserProfileUrl(userName: string, account: accountSession): string;
getMyProfileUrl(account: accountSession): string;
getSignupUrl(enablePassword?: boolean): string;
getSigninUrl(): string;
getUserProfileUrl(userName: string, account: account): string;
getMyProfileUrl(account: account): string;
signin(serverUrl: string): Promise<Response>;
}
export default Sdk;

@@ -0,1 +1,14 @@

// Copyright 2021 The casbin Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
class Sdk {

@@ -5,6 +18,12 @@ constructor(config) {

}
getSignupUrl() {
return `${this.config.serverUrl.trim()}/signup/${this.config.appName}`;
getSignupUrl(enablePassword = true) {
if (enablePassword) {
return `${this.config.serverUrl.trim()}/signup/${this.config.appName}`;
}
else {
return this.getSigninUrl().replace("/login/oauth/authorize", "/signup/oauth/authorize");
}
}
getSigninUrl(redirectUri = `${window.location.origin}/callback`) {
getSigninUrl() {
const redirectUri = `${window.location.origin}/callback`;
const scope = "read";

@@ -28,3 +47,10 @@ const state = this.config.appName;

}
signin(serverUrl) {
const params = new URLSearchParams(window.location.search);
return fetch(`${serverUrl}/api/signin?code=${params.get("code")}&state=${params.get("state")}`, {
method: "POST",
credentials: "include",
}).then(res => res.json());
}
}
export default Sdk;
{
"name": "casdoor-js-sdk",
"version": "0.0.1",
"version": "0.0.2",
"description": "Javascript client SDK for Casdoor",
"main": "lib/cjs/index.js",

@@ -22,6 +23,24 @@ "typings": "lib/cjs/index.d.ts",

],
"keywords": [
"auth",
"authn",
"authentication",
"sso",
"oauth",
"oidc",
"casbin",
"casdoor"
],
"repository": {
"type": "git",
"url": "https://github.com/casdoor/casdoor-js-sdk.git"
}
},
"author": {
"name": "Zxilly",
"email": "zxilly@outlook.com"
},
"bugs": {
"url": "https://github.com/casdoor/casdoor-js-sdk/issues"
},
"homepage": "https://github.com/casdoor/casdoor-js-sdk"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc