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

@okta/okta-vue

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@okta/okta-vue - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0

src/Auth.spec.js

32

package.json
{
"name": "@okta/okta-vue",
"version": "0.0.3",
"version": "0.1.0",
"description": "Vue support for Okta",

@@ -11,10 +11,29 @@ "main": "dist/okta-vue.js",

"scripts": {
"prebuild": "npm run build:package-info",
"prestart": "npm run build",
"pretest": "npm run build",
"pretest": "npm run build && npm run build:harness",
"prepublish": "npm run build",
"test": "npm run --prefix test/e2e/harness/ e2e",
"jest": "jest src/",
"test": "npm run lint && npm run jest && npm run --prefix test/e2e/harness/ test",
"start": "npm run --prefix test/e2e/harness/ start",
"build": "rimraf dist/ && cross-env NODE_ENV=production webpack --config webpack.config.js --output-library-target=umd -p",
"build:harness": "npm --prefix test/e2e/harness install",
"build:package-info": "node ../../util/write-package-info.js . src/packageInfo.js",
"lint": "eslint --ext .js,.vue src"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"vue"
],
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/babel-jest",
".*\\.(vue)$": "<rootDir>/node_modules/vue-jest"
},
"moduleNameMapper": {
"^@/(.*)$": "<rootDir>/src/$1"
},
"mapCoverage": true
},
"repository": {

@@ -34,3 +53,3 @@ "type": "git",

"dependencies": {
"@okta/okta-auth-js": "^1.11.0",
"@okta/okta-auth-js": "^1.14.0",
"cross-env": "^5.1.1",

@@ -41,5 +60,7 @@ "vue": "^2.5.9",

"devDependencies": {
"@vue/test-utils": "^1.0.0-beta.12",
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-jest": "^23.0.0-alpha.0",
"babel-loader": "^7.1.1",

@@ -57,5 +78,7 @@ "babel-plugin-transform-runtime": "^6.22.0",

"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jest": "^21.15.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"jest": "^22.4.2",
"nightwatch": "^0.9.12",

@@ -65,2 +88,3 @@ "rimraf": "^2.6.2",

"url-loader": "^0.5.8",
"vue-jest": "^2.1.1",
"vue-loader": "13.0.2",

@@ -67,0 +91,0 @@ "vue-style-loader": "^3.0.1",

8

README.md
# Okta Vue SDK
The Okta Vue SDK is a wrapper around [Okta Auth JS](https://github.com/okta/okta-auth-js), that builds on top of Okta's [OpenID Connect API](https://developer.okta.com/docs/api/resources/oidc.html).
The Okta Vue SDK is a wrapper around the [Okta Auth SDK](https://github.com/okta/okta-auth-js), which builds on top of Okta's [OpenID Connect API](https://developer.okta.com/docs/api/resources/oidc.html).

@@ -117,3 +117,2 @@ This library currently supports:

<script>
export default {

@@ -218,3 +217,3 @@ name: 'app',

#### `$auth.loginRedirect`
Performs a full page redirect to Okta based on the initial configuration. If you have an Okta `sessionToken`, you can bypass the full-page redirect by passing in this token. This is recommended when using the[Okta Sign-In Widget](https://github.com/okta/okta-signin-widget). Simply pass in a `sessionToken` into the `loginRedirect` method follows:
Performs a full page redirect to Okta based on the initial configuration. If you have an Okta `sessionToken`, you can bypass the full-page redirect by passing in this token. This is recommended when using the [Okta Sign-In Widget](https://github.com/okta/okta-signin-widget). Simply pass in a `sessionToken` into the `loginRedirect` method follows:

@@ -254,4 +253,3 @@ ```typescript

5. Update environment variables
- Set the `ISSUER` and `CLIENT_ID` variables in the `test/e2e/harness/config/dev.env.js` file.
- Manually set the `USERNAME` and `PASSWORD` environment variables via the command line. For example: `export USERNAME={username}`
- Manually set the `ISSUER`, `CLIENT_ID`, `USERNAME` and `PASSWORD` environment variables via the command line. For example: `export USERNAME={username}`

@@ -258,0 +256,0 @@ ## Commands

@@ -1,2 +0,3 @@

import * as AuthJS from '@okta/okta-auth-js'
import AuthJS from '@okta/okta-auth-js'
import packageInfo from './packageInfo'
import ImplicitCallback from './components/ImplicitCallback'

@@ -12,2 +13,3 @@

})
oktaAuth.userAgent = `${packageInfo.name}/${packageInfo.version} ${oktaAuth.userAgent}`

@@ -51,8 +53,17 @@ Vue.prototype.$auth = {

const accessToken = oktaAuth.tokenManager.get('accessToken')
return accessToken ? oktaAuth.token.getUserInfo(accessToken) : undefined
const idToken = oktaAuth.tokenManager.get('idToken')
if (accessToken && idToken) {
const userinfo = await oktaAuth.token.getUserInfo(accessToken)
if (userinfo.sub === idToken.claims.sub) {
// Only return the userinfo response if subjects match to
// mitigate token substitution attacks
return userinfo
}
}
return idToken ? idToken.claims : undefined
},
authRedirectGuard () {
return async (from, to, next) => {
if (from.matched.some(record => record.meta.requiresAuth) && !(await this.isAuthenticated())) {
localStorage.setItem('referrerPath', from.path || '/')
return async (to, from, next) => {
if (to.matched.some(record => record.meta.requiresAuth) && !(await this.isAuthenticated())) {
localStorage.setItem('referrerPath', to.path || '/')
this.loginRedirect()

@@ -59,0 +70,0 @@ } else {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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