chore(console): move OAuth console out

This commit is contained in:
vladikoff 2019-07-29 11:47:10 -04:00 коммит произвёл Jared Hirsch
Родитель 60539d9ced
Коммит eb752efab9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7929C0057BF4E690
213 изменённых файлов: 0 добавлений и 17974 удалений

Просмотреть файл

@ -337,11 +337,6 @@ workflows:
db: true db: true
requires: requires:
- install - install
- build-module:
name: fxa-oauth-console
module: fxa-oauth-console
requires:
- install
- build-module: - build-module:
name: fxa-payments-server name: fxa-payments-server
module: fxa-payments-server module: fxa-payments-server
@ -460,16 +455,6 @@ workflows:
module: fxa-event-broker module: fxa-event-broker
requires: requires:
- install - install
- deploy-module:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
name: fxa-oauth-console
module: fxa-oauth-console
requires:
- install
- deploy-module: - deploy-module:
filters: filters:
tags: tags:

Просмотреть файл

@ -20,7 +20,6 @@ PATH=$PATH:$HOME/.cargo/bin
"cd fxa-js-client; npm ci; npx grunt sjcl" \ "cd fxa-js-client; npm ci; npx grunt sjcl" \
"cd fxa-customs-server; npm ci" \ "cd fxa-customs-server; npm ci" \
"cd fxa-event-broker; npm ci" \ "cd fxa-event-broker; npm ci" \
"cd fxa-oauth-console; npm ci" \
"cd fxa-payments-server; npm ci" \ "cd fxa-payments-server; npm ci" \
"cd fxa-profile-server; npm ci; mkdir -p var/public/" \ "cd fxa-profile-server; npm ci; mkdir -p var/public/" \
"cd fxa-basket-proxy; npm ci" \ "cd fxa-basket-proxy; npm ci" \

Просмотреть файл

@ -1,4 +0,0 @@
{
"directory": "bower_components",
"analytics": false
}

Просмотреть файл

@ -1,73 +0,0 @@
# These environment variables must be set in CircleCI UI
#
# DOCKERHUB_REPO - docker hub repo, format: <username>/<repo>
# DOCKER_EMAIL - login info for docker hub
# DOCKER_USER
# DOCKER_PASS
#
version: 2
jobs:
build:
docker:
- image: circleci/node
steps:
- checkout
- setup_remote_docker
- run:
name: Create version.json
command: >
printf '{"version":{"hash":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}}\n'
"$CIRCLE_SHA1"
"$CIRCLE_TAG"
"$CIRCLE_PROJECT_USERNAME"
"$CIRCLE_PROJECT_REPONAME"
"$CIRCLE_BUILD_URL"
| tee config/version.json version.json
- store_artifacts:
path: version.json
- run:
name: Build deployment container image
command: docker build -f Dockerfile-build -t fxa-oauth-console:build .
- run:
name: Push to Dockerhub
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
DOCKER_TAG="latest"
fi
if [[ "${CIRCLE_BRANCH}" == feature* ]] || [[ "${CIRCLE_BRANCH}" == dockerpush* ]]; then
DOCKER_TAG="${CIRCLE_BRANCH}"
fi
if [ -n "${CIRCLE_TAG}" ]; then
DOCKER_TAG="$CIRCLE_TAG"
fi
if [ -n "${DOCKER_TAG}" ]; then
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
echo ${DOCKERHUB_REPO}:${DOCKER_TAG}
docker tag fxa-oauth-console:build ${DOCKERHUB_REPO}:${DOCKER_TAG}
docker images
docker push ${DOCKERHUB_REPO}:${DOCKER_TAG}
fi
workflows:
version: 2
# workflow jobs are _not_ run in tag builds by default
# we use filters to whitelist jobs that should be run for tags
# workflow jobs are run in _all_ branch builds by default
# we use filters to blacklist jobs that shouldn't be run for a branch
# see: https://circleci.com/docs/2.0/workflows/#git-tag-job-execution
build-test-push:
jobs:
- build:
filters:
tags:
only: /.*/

Просмотреть файл

@ -1,12 +0,0 @@
*~
node_modules
bower_components
tmp
dist
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log

Просмотреть файл

@ -1,34 +0,0 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
[*.js]
indent_style = space
indent_size = 2
[*.hbs]
insert_final_newline = false
indent_style = space
indent_size = 2
[*.css]
indent_style = space
indent_size = 2
[*.html]
indent_style = space
indent_size = 2
[*.{diff,md}]
trim_trailing_whitespace = false

Просмотреть файл

@ -1,9 +0,0 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.
Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
}

Просмотреть файл

@ -1,6 +0,0 @@
{
"extends": "prettier",
"parserOptions": {
"ecmaVersion": 2018
}
}

17
packages/fxa-oauth-console/.gitignore поставляемый
Просмотреть файл

@ -1,17 +0,0 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
# dependencies
/node_modules
/bower_components
# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log

Просмотреть файл

@ -1,10 +0,0 @@
LICENSE
.*
*.txt
*.log
*.hbs
Dockerfile*
CHANGELOG
CONTRIBUTORS
bower_components
public/assets/*

Просмотреть файл

@ -1,4 +0,0 @@
{
"singleQuote": true,
"trailingComma": "es5"
}

Просмотреть файл

@ -1,18 +0,0 @@
language: node_js
addons:
firefox: "39.0"
sudo: false
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
node_js:
- '4'
script:
- npm i
- grunt lint
- node_modules/.bin/ember test

Просмотреть файл

@ -1,3 +0,0 @@
{
"ignore_dirs": ["tmp", "dist"]
}

Просмотреть файл

@ -1,59 +0,0 @@
v0.5.1:
date: 2018-08-09
changes:
- add package lock
- fix client registration
v0.5.0:
date: 2017-09-28
changes:
- dependency updates
- ember 2.4 update
v0.4.2:
date: 2017-09-27
changes:
- dependency updates
v0.4.1:
date: 2016-02-05
changes:
- better session handling
- dependency updates
v0.4.0:
date: 2016-02-05
changes:
- better session handling
- dependency updates
v0.3.8:
date: 2015-06-03
changes:
- fixes oauth trusted setting
v0.3.7:
date: 2015-05-07
changes:
- update default image uri to blank
- adds developer activation
- Support OAuth internal server
v0.3.6:
date: 2015-03-04
changes:
- Adds login note to the login screen
v0.3.5:
date: 2015-02-21
changes:
- Fixes to support new OAuth server validation
v0.3.4:
date: 2015-01-23
changes:
- Added Sample Configuration display when a client gets created.
- Design updates.
v0.3.0:
date: 2014-11-06
changes:
- Added a way to request tokens with custom scopes.
v0.2.0:
date: 2014-10-01
changes:
- Ability to create clients, update, delete.
v0.1.0
date: 2014-09-28
changes:
- Initial app

Просмотреть файл

@ -1,81 +0,0 @@
# Contributing
Anyone is welcome to help with Firefox Accounts. Feel free to get in touch with other community members on IRC, the
mailing list or through issues here on GitHub.
- IRC: `#fxa` on `irc.mozilla.org`
- Mailing list: <https://mail.mozilla.org/listinfo/dev-fxacct>
- and of course, [the issues list](https://github.com/mozilla/fxa-oauth-server/issues)
## Bug Reports
You can file issues here on GitHub. Please try to include as much information as you can and under what conditions
you saw the issue.
## Sending Pull Requests
Patches should be submitted as pull requests (PR).
Before submitting a PR:
- Your code must run and pass all the automated tests before you submit your PR for review. "Work in progress" pull requests are allowed to be submitted, but should be clearly labeled as such and should not be merged until all tests pass and the code has been reviewed.
- Run `npm test` to make sure all tests still pass and there are no lint errors.
- Your patch should include new tests that cover your changes. It is your and your reviewer's responsibility to ensure your patch includes adequate tests.
When submitting a PR:
- You agree to license your code under the project's open source license ([MPL 2.0](/LICENSE)).
- Base your branch off the current `master` (see below for an example workflow).
- Add both your code and new tests if relevant.
- Run `grunt jshint` and `npm test` to make sure your code passes linting and tests.
- Please do not include merge commits in pull requests; include only commits with the new relevant code.
See the main [README.md](/README.md) for information on prerequisites, installing, running and testing.
## Code Review
This project is production Mozilla code and subject to our [engineering practices and quality standards](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Committing_Rules_and_Responsibilities). Every patch must be peer reviewed. This project is part of the [Firefox Accounts module](https://wiki.mozilla.org/Modules/Other#Firefox_Accounts), and your patch must be reviewed by one of the listed module owners or peers.
## Example Workflow
This is an example workflow to make it easier to submit Pull Requests. Imagine your username is `user1`:
1. Fork this repository via the GitHub interface
2. The clone the upstream (as origin) and add your own repo as a remote:
```sh
$ git clone https://github.com/mozilla/fxa-oauth-console.git
$ cd fxa-oauth-console
$ git remote add user1 git@github.com:user1/fxa-oauth-console.git
```
3. Create a branch for your fix/feature and make sure it's your currently checked-out branch:
```sh
$ git checkout -b add-new-feature
```
4. Add/fix code, add tests then commit and push this branch to your repo:
```sh
$ git add <files...>
$ git commit
$ git push user1 add-new-feature
```
5. From the GitHub interface for your repo, click the `Review Changes and Pull Request` which appears next to your new branch.
6. Click `Send pull request`.
### Keeping up to Date
The main reason for creating a new branch for each feature or fix is so that you can track master correctly. If you need
to fetch the latest code for a new fix, try the following:
```sh
$ git checkout master
$ git pull
```
Now you're ready to branch again for your new feature (from step 3 above).

Просмотреть файл

@ -1 +0,0 @@
Vlad Filippov

Просмотреть файл

@ -1,21 +0,0 @@
FROM node:4.8.2-alpine
RUN apk add --no-cache git
RUN addgroup -g 10001 app && \
adduser -D -G app -h /app -u 10001 app
WORKDIR /app
COPY package.json package.json
COPY bower.json bower.json
RUN npm install --unsafe-perm --loglevel=warn && rm -rf ~app/.npm /tmp/*
# S3 bucket in Cloud Services prod IAM
ADD https://s3.amazonaws.com/dumb-init-dist/v1.2.0/dumb-init_1.2.0_amd64 /usr/local/bin/dumb-init
RUN chmod +x /usr/local/bin/dumb-init
ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]
COPY . /app
RUN npm run build

Просмотреть файл

@ -1,17 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global require, module */
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('./package.json'),
mainJsFiles:
'{,lib/**/,scripts/**/,test/**/,tasks/**/,bin/**/,app/**/}*.js',
});
grunt.loadTasks('tasks');
grunt.registerTask('lint', ['copyright', 'eslint']);
};

Просмотреть файл

@ -1,373 +0,0 @@
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

Просмотреть файл

@ -1,44 +0,0 @@
# Firefox Accounts OAuth Credential Management Dashboard
[![Build Status](https://travis-ci.org/mozilla/fxa-oauth-console.svg?branch=master)](https://travis-ci.org/mozilla/fxa-oauth-console)
![](https://mdn.mozillademos.org/files/9783/dashboard-example.jpg)
## Development
```
git clone https://github.com/mozilla/fxa-oauth-console
cd fxa-oauth-console
npm install
```
Run development server locally:
```
npm start
```
## Docker Dev
You can run the docker container by:
- `docker-compose build`
- `docker-compose up`
#### Changing environment configuration.
You can customize the servers that the app communicates with by passing them in the docker-compose file.
```yml
environment:
PROFILE_URI: https://127.0.0.1:9010/v1
OAUTH_INTERNAL_URI: https://127.0.0.1:9010/v1
OAUTH_URI: https://127.0.0.1:1111/profile/v1
```
**You will need a local Firefox Accounts stack to login to the console.** Use [fxa-local-dev](https://github.com/vladikoff/fxa-local-dev) to get started.
Run tests: `npm test`
## License
[MPL v2.0](LICENSE)

Просмотреть файл

@ -1,7 +0,0 @@
{
"extends": "prettier",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
}
}

Просмотреть файл

@ -1,163 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import DS from 'ember-data';
import config from '../config/environment';
function fixUpRedirectUri(uri) {
if (!uri) {
// add some defaults, oauth server requires these fields
uri = 'http://';
}
return uri.trim();
}
export default DS.RESTAdapter.extend({
_handleErrorResponse: function() {
this.get('session').invalidate();
},
session: Ember.inject.service('session'),
/**
* API Namespace
*/
namespace: 'v1',
/**
* API Host
*/
host: config.servers.oauthInternal,
/**
* Request headers
*
* Sets Authorization headers
*/
headers: Ember.computed(function() {
return {
Authorization: 'Bearer ' + this.get('session.data.authenticated.token'),
};
}),
shouldReloadAll() {
return true;
},
shouldBackgroundReloadRecord() {
return true;
},
/**
* Overrides default RESTAdapter 'find'.
*
* @param store
* @param type
* @param id
* @param record
* @returns {*}
*/
findRecord: function(store, type, id, record) {
// post process the resuld of 'findRecord'. Need to add the Model type 'client' into the response
return this.ajax(this.buildURL(type.modelName, id, record), 'GET').then(
function(resp) {
return { client: resp };
}
);
},
/**
* Overrides default RESTAdapter 'createRecord'
*
* @param store
* @param type
* @param record
* @returns {*}
*/
createRecord: function(store, type, record) {
var data = {};
var serializer = store.serializerFor(type.modelName);
serializer.serializeIntoHash(data, type, record, { includeId: true });
delete data.secret;
data.redirect_uri = fixUpRedirectUri(data.redirect_uri); //eslint-disable-line camelcase
// post process the result of 'find'. Need to add the Model type 'client' into the response
return this.ajax(this.buildURL(type.modelName, null, record), 'POST', {
data: data,
}).then(
resp => {
return { client: resp };
},
() => {
this._handleErrorResponse();
}
);
},
/**
* Overrides default RESTAdapter 'updateRecord'
* @param store
* @param type
* @param record
* @returns {*}
*/
updateRecord: function(store, type, record) {
var data = {};
var serializer = store.serializerFor(type.modelName);
serializer.serializeIntoHash(data, type, record);
var id = record.id;
delete data.secret;
delete data.trusted;
data.redirect_uri = fixUpRedirectUri(data.redirect_uri); //eslint-disable-line camelcase
// set POST instead of PUT
return this.ajax(this.buildURL(type.modelName, id, record), 'POST', {
data: data,
}).then(
() => {
data.id = id;
return { client: data };
},
() => {
this._handleErrorResponse();
}
);
},
/**
/**
* Overrides default RESTAdapter 'buildURL'.
* @param type
* @param id
* @param record
* @returns {Array}
*/
buildURL: function(type, id, record) {
var url = [];
var host = this.host;
var prefix = this.urlPrefix();
// FxA OAuth API requires singular 'client' when the record id is set
if (record) {
url.push('client');
} else {
url.push('clients');
}
if (id && !Ember.isArray(id)) {
url.push(encodeURIComponent(id));
}
if (prefix) {
url.unshift(prefix);
}
url = url.join('/');
if (!host && url) {
url = '/' + url;
}
return url;
},
});

Просмотреть файл

@ -1,22 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';
let App;
Ember.MODEL_FACTORY_INJECTIONS = true;
App = Ember.Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver,
});
loadInitializers(App, config.modulePrefix);
export default App;

Просмотреть файл

@ -1,100 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import Base from 'ember-simple-auth/authenticators/base';
import config from '../config/environment';
/**
* Custom Ember Simple Auth Authenticator
* See docs: http://ember-simple-auth.simplabs.com/ember-simple-auth-api-docs.html
*/
export default Base.extend({
/**
* Token endpoint
*/
tokenEndpoint: config.baseURL + 'oauth',
/**
* Restores application session data
*
* @param data
* @returns {Rx.Promise}
*/
restore: function(data) {
return new Ember.RSVP.Promise(function(resolve, reject) {
if (!Ember.isEmpty(data.token)) {
resolve(data);
} else {
reject();
}
});
},
/**
* Authenticate the user using the server side endpoint
*
* @returns {Rx.Promise}
*/
authenticate: function() {
var self = this;
return new Ember.RSVP.Promise(function(resolve, reject) {
Ember.$.ajax({
url: self.tokenEndpoint + '/status',
type: 'GET',
contentType: 'application/json',
}).then(
function(response) {
try {
response = JSON.parse(response);
} catch (e) {
return reject(e);
}
Ember.run(function() {
if (response && response.email && response.token) {
return resolve({
email: response.email,
token: response.token,
});
} else {
return reject('Response missing credential data.');
}
});
},
function(xhr /*, status, error*/) {
var response = xhr.responseText;
try {
response = JSON.parse(xhr.responseText);
} catch (e) {
return reject();
}
Ember.run(function() {
return reject(response.error);
});
}
);
});
},
/**
* Invalidates the user session on the server
*
* @returns {Rx.Promise}
*/
invalidate: function() {
var self = this;
return new Ember.RSVP.Promise(function(resolve) {
Ember.$.ajax({
url: self.tokenEndpoint + '/logout',
type: 'GET',
}).always(function() {
return resolve();
});
});
},
});

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,14 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
export default Ember.Controller.extend({
session: Ember.inject.service('session'),
actions: {
invalidateSession() {
this.get('session').invalidate();
},
},
});

Просмотреть файл

@ -1,13 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import config from '../../config/environment';
export default Ember.Controller.extend({
session: Ember.inject.service('session'),
registrationSuccess: false,
oauth_uri: config.servers.oauthUriParsed.href, //eslint-disable-line camelcase
profile_uri: config.servers.profileUriParsed.href, //eslint-disable-line camelcase
});

Просмотреть файл

@ -1,11 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
export default Ember.Controller.extend({
session: Ember.inject.service('session'),
sortProperties: ['name'],
sortAscending: true,
});

Просмотреть файл

@ -1,11 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import config from '../config/environment';
export default Ember.Controller.extend({
session: Ember.inject.service('session'),
server: config.servers.oauth.replace('https://', '').replace('http://', ''),
});

Просмотреть файл

Просмотреть файл

@ -1,25 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Firefox Accounts OAuth Credential Management Dashboard</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
{{content-for 'head'}}
<link rel="stylesheet" href="assets/vendor.css" />
<link rel="stylesheet" href="assets/fxa-oauth-console.css" />
{{content-for 'head-footer'}}
</head>
<body>
{{content-for 'body'}}
<script src="assets/vendor.js"></script>
<script src="assets/fxa-oauth-console.js"></script>
{{content-for 'body-footer'}}
</body>
</html>

Просмотреть файл

Просмотреть файл

@ -1,13 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr('string'),
redirect_uri: DS.attr('string'), //eslint-disable-line camelcase
secret: DS.attr('string'),
can_grant: DS.attr('boolean'), //eslint-disable-line camelcase
trusted: DS.attr('boolean'),
});

Просмотреть файл

@ -1,28 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: config.locationType,
});
Router.map(function() {
this.route('login');
this.route('clients', { path: '/clients' });
this.route('clients.token', { path: '/clients/token' });
this.route('client.register', { path: '/client/register' });
this.route(
'client',
{ path: '/client/:client_id', resetNamespace: true },
function() {
this.route('delete');
this.route('update');
}
);
});
export default Router;

Просмотреть файл

Просмотреть файл

@ -1,30 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';
export default Ember.Route.extend(ApplicationRouteMixin, {
session: Ember.inject.service('session'),
beforeModel: function() {
this.get('session').authenticate('authenticator:custom');
},
actions: {
authenticateSession: function() {
this.get('session').authenticate('authenticator:custom', {});
},
sessionAuthenticationFailed: function(/*error*/) {
this.transitionTo('login');
},
sessionInvalidationSucceeded: function() {
this.transitionTo('login');
},
sessionInvalidationFailed: function(/*error*/) {
this.transitionTo('login');
},
sessionAuthenticationSucceeded: function() {
this.transitionTo('index');
},
},
});

Просмотреть файл

@ -1,20 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
actions: {
remove: function(model) {
var self = this;
return this.store.find('client', model.id).then(function(client) {
client.destroyRecord().then(function() {
self.transitionTo('clients');
});
});
},
},
});

Просмотреть файл

@ -1,19 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
actions: {
update: function(model) {
this.transitionTo('client.update', model);
},
remove: function(id) {
return this.store.find('client', id).then(function(client) {
client.destroyRecord();
});
},
},
});

Просмотреть файл

@ -1,45 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
controllerName: 'client/register',
actions: {
create: function() {
var model = this.controllerFor('client.register').get('model');
return model
.save()
.then(() =>
this.controllerFor('client.register').set('registrationSuccess', true)
);
},
cancel: function() {
this.transitionTo('clients');
return true;
},
registerDone: function() {
this.transitionTo('clients');
return true;
},
},
setupController: function(controller, model) {
controller.set('model', model);
},
model: function() {
this.controllerFor('client.register').set('registrationSuccess', false);
return this.store.createRecord('client', {});
},
deactivate: function() {
var model = this.controllerFor('client.register').get('model');
model.rollbackAttributes();
},
error: function(/*error , transition*/) {
// if there is an error fetching the client list
// then for now just invalidate the session
this.get('session').invalidate();
},
});

Просмотреть файл

@ -1,26 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
actions: {
update: function() {
var self = this;
var model = this.controllerFor('client.update').get('model');
return model.save().then(function() {
self.transitionTo('client.index', model.id);
});
},
cancel: function() {
return this.transitionTo('clients');
},
},
deactivate: function() {
var model = this.controllerFor('client.update').get('model');
model.rollbackAttributes();
},
});

Просмотреть файл

@ -1,51 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
import Client from '../models/client';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
session: Ember.inject.service('session'),
actions: {
goToNewClient: function() {
this.transitionTo('client.register');
},
goToClientDelete: function(model) {
this.transitionTo('client.delete', model);
},
goToScopedToken: function() {
this.transitionTo('clients.token');
},
goToClient: function(id) {
// unload all stored client data to make sure we fetch the client again in the client view
this.store.unloadAll('client');
this.transitionTo('client', id);
},
update: function(model) {
this.transitionTo('client.update', model);
},
create: function(model) {
this.storage.create(model);
this.transitionTo('clients');
},
updated: function(model) {
this.storage.update(model);
this.transitionTo('clients');
},
cancel: function(model) {
Ember.run(model, 'destroy');
this.storage.refresh(Client);
this.transitionTo('clients');
},
error: function(/*error , transition*/) {
// if there is an error fetching the client list
// then for now just invalidate the session
this.get('session').invalidate();
},
},
model: function() {
return this.store.findAll('client');
},
});

Просмотреть файл

@ -1,35 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
import config from '../../config/environment';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
setupController: function(controller, model, queryParams) {
controller.set(
'access_token',
queryParams.state.fullQueryParams.access_token
);
controller.set('scopes', queryParams.state.fullQueryParams.scopes);
},
actions: {
/**
* Requests a fresh OAuth bearer token by asking the user to login again.
*/
requestToken: function() {
var tokenUrl = config.baseURL + 'oauth/generate-token';
var form = Ember.$('<form />', {
action: tokenUrl,
method: 'POST',
});
form.append(
'<input type=hidden name=scopes value="' +
Ember.$('#scopes').val() +
'" />'
);
form.appendTo('body').submit();
},
},
});

Просмотреть файл

@ -1,13 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
beforeModel: function() {
this.get('session').authenticate('authenticator:custom');
return this.transitionTo('clients');
},
});

Просмотреть файл

@ -1,10 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin';
export default Ember.Route.extend(UnauthenticatedRouteMixin, {
session: Ember.inject.service('session'),
});

Просмотреть файл

@ -1,13 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Ember from 'ember';
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
isNewSerializerAPI: true,
serializeIntoHash: function(hash, type, record, options) {
Ember.merge(hash, this.serialize(record, options));
},
});

Просмотреть файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,111 +0,0 @@
@import 'settings';
@import 'public/assets/fonts/fira/fira';
@import 'bower_components/foundation/scss/foundation';
// Or selectively include components
// @import
// "foundation/components/accordion",
// "foundation/components/alert-boxes",
// "foundation/components/block-grid",
// "foundation/components/breadcrumbs",
// "foundation/components/button-groups",
// "foundation/components/buttons",
// "foundation/components/clearing",
// "foundation/components/dropdown",
// "foundation/components/dropdown-buttons",
// "foundation/components/flex-video",
// "foundation/components/forms",
// "foundation/components/grid",
// "foundation/components/inline-lists",
// "foundation/components/joyride",
// "foundation/components/keystrokes",
// "foundation/components/labels",
// "foundation/components/magellan",
// "foundation/components/orbit",
// "foundation/components/pagination",
// "foundation/components/panels",
// "foundation/components/pricing-tables",
// "foundation/components/progress-bars",
// "foundation/components/reveal",
// "foundation/components/side-nav",
// "foundation/components/split-buttons",
// "foundation/components/sub-nav",
// "foundation/components/switch",
// "foundation/components/tables",
// "foundation/components/tabs",
// "foundation/components/thumbs",
// "foundation/components/tooltips",
// "foundation/components/top-bar",
// "foundation/components/type",
// "foundation/components/offcanvas",
// "foundation/components/visibility";
a,
h1,
h2,
h3,
h4,
h5,
h6,
button,
.button,
th,
p,
legend,
label {
font-family: 'Fira Sans';
}
.title-area {
a {
font-weight: 300;
}
img {
width: 75px;
margin-right: 10px;
}
}
.table {
width: 100%;
&.table-clients {
a {
font-weight: bold;
font-size: 20px;
padding: 10px 0;
display: block;
}
}
td.table-actions {
width: 25%;
text-align: center;
}
}
.login-panel {
text-align: center;
img {
width: 270px;
margin: 10px 0;
}
h3 {
font-weight: lighter;
font-size: 20px;
}
h4 {
padding: 10px;
font-size: 20px;
font-weight: bold;
}
}
.alert-box.secondary-notification {
border-color: #c7c7c7;
background: #e7e7e7;
color: $primary-color;
text-align: center;
}
.centered {
text-align: center;
}

Просмотреть файл

Просмотреть файл

@ -1,39 +0,0 @@
<div class="contain-to-grid">
<nav class="top-bar" data-topbar>
<ul class="title-area">
<li class="name">
<h1>
<a href="#">
<img src="assets/firefox.png" alt="Firefox Accounts"/>FxA OAuth Credential Management
</a>
</h1>
</li>
</ul>
<section class="top-bar-section">
<ul class="right">
{{#if session.isAuthenticated}}
<li><button id="logout" {{ action 'invalidateSession' }}>Logout</button></li>
{{/if}}
</ul>
</section>
</nav>
</div>
<div class="row">
{{outlet}}
</div>
<footer class="row">
<div class="large-12 columns">
<hr/>
<div class="row">
<div class="large-12 columns">
<ul class="inline-list right">
<li><a href="https://github.com/mozilla/fxa-oauth-console">Source on GitHub</a></li>
<li>|</li>
<li><a href="https://github.com/mozilla/fxa-oauth-console/issues">Issue Tracker</a></li>
</ul>
</div>
</div>
</div>
</footer>

Просмотреть файл

@ -1,19 +0,0 @@
<fieldset>
<legend>Are you sure you want to delete <em>{{model.name}}</em>?</legend>
<table class="table">
<tbody>
<tr>
<th>Client ID:</th>
<td>{{model.id}}</td>
</tr>
<tr>
<th>Redirect URI</th>
<td>{{model.redirect_uri}}</td>
</tr>
</tbody>
</table>
<button class="small button alert" {{action 'remove' this}}>Confirm</button>
</fieldset>
{{outlet}}

Просмотреть файл

@ -1,40 +0,0 @@
{{#unless registrationSuccess}}
<div class="form-group">
<label for="inputTitle">Client Name</label>
{{input value=model.name id="inputTitle" required="required"}}
</div>
<div class="form-group">
<label for="inputRedirect">Redirect URI</label>
{{input value=model.redirect_uri id="inputRedirect" required="required"}}
</div>
{{/unless}}
<div class="form-group">
<p>This client is {{#if model.trusted}}<strong>a trusted</strong>{{else}}<strong>not a trusted</strong>{{/if}} Mozilla Firefox Accounts client.</p>
</div>
{{#if id}}
<div class="form-group">
<label for="id">Client Id:</label>
<pre>{{model.id}}</pre>
</div>
{{/if}}
{{#if model.secret}}
<label for="secret" >Client Secret</label>
<pre id="secret">{{model.secret}}</pre>
<p style="color:red; font-size: 20px;">Save this secret above, you will never see it again.</p>
<h2>Sample Configuration for your application:</h2>
<pre>
{
"client_id": "{{model.id}}",
"client_secret": "{{model.secret}}",
"redirect_uri": "{{model.redirect_uri}}",
"oauth_uri": "{{oauth_uri}}",
"profile_uri": "{{profile_uri}}",
"scopes": "ADD OAUTH SCOPES HERE"
}
</pre>
<div class="btn-group">
<button class="button" {{action 'registerDone' this}}>Back to Clients</button>
</div>
{{/if}}

Просмотреть файл

@ -1,38 +0,0 @@
<h3>OAuth Client: <strong>{{model.name}}</strong></h3>
<table class="table">
<tbody>
<tr>
<th>Client ID:</th>
<td>{{model.id}}</td>
</tr>
<tr>
<th>Redirect URI</th>
<td>{{model.redirect_uri}}</td>
</tr>
<tr>
<td colspan="2">
<p>This client is {{#if model.trusted}}<strong>a trusted</strong>{{else}}<strong>not a trusted</strong>{{/if}} Firefox Accounts client.</p>
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="medium-6 columns">
<ul class="inline-list ">
<li>
{{#link-to 'clients' classNames="small button success"}}Back to Clients{{/link-to}}
</li>
</ul>
</div>
<div class="medium-6 columns">
<ul class="inline-list right">
<li>
<button class="small button " {{action 'update' model.id}}>Update Client</button>
</li>
</ul>
</div>
</div>
{{outlet}}

Просмотреть файл

@ -1,25 +0,0 @@
<form class="form-horizontal" role="form" {{action 'create' on="submit"}}>
<fieldset>
{{#if model.name}}
<legend>Client: {{model.name}}</legend>
{{else}}
<legend>New Client</legend>
{{/if}}
{{#unless registrationSuccess}}
<div class="form-group">
<label for="trusted">Trusted Mozilla Client: {{input type="checkbox" name=model.trusted checked=model.trusted id="trusted"}}</label>
</div>
{{/unless}}
{{partial 'client/form'}}
</fieldset>
{{#unless model.secret}}
<div class="btn-group">
<button type="submit" class="button success register-create">Create</button>
<button class="button alert register-cancel" {{action 'cancel' this}}>Cancel</button>
</div>
{{/unless}}
</form>

Просмотреть файл

@ -1,12 +0,0 @@
<form class="form-horizontal" role="form" {{action 'update' on="submit"}}>
<fieldset>
<legend>Edit client</legend>
{{partial 'client/form'}}
</fieldset>
<div class="btn-group">
<button type="submit" class="btn btn-large btn-primary">Update</button>
<button class="btn btn-large btn-danger" {{action 'cancel' this}}>Cancel</button>
</div>
</form>

Просмотреть файл

@ -1,44 +0,0 @@
<ul class="inline-list left">
<li>
<button {{action 'goToNewClient' }} class="small button success new-client">+ Create a new OAuth Client</button>
</li>
</ul>
<ul class="inline-list right">
<li>
<button {{action 'goToScopedToken' }} class="small button success scoped-token">Get an OAuth Scoped Token</button>
</li>
</ul>
<hr/>
{{#if content}}
<table class="table table-clients">
<tbody>
<tr>
<th>Name</th>
<th>Redirect URI</th>
</tr>
{{#each content as |client|}}
<tr>
<td><a {{action 'goToClient' client.id}}>{{client.name}}</a>{{client.id}}</td>
<td>{{client.redirect_uri}}</td>
<td class="table-actions">
<button class="small button " {{action 'update' client.id}}>Update</button>
<button class="small button alert" {{action 'goToClientDelete' client.id}}>Delete</button>
</td>
</tr>
{{/each}}
</tbody>
</table>
{{else}}
<div class="row">
<div class="small-8 small-centered columns centered">
<h4>You have no FxA OAuth clients.</h4>
<p>Click the "Create a new OAuth Client" button to begin.</p>
</div>
</div>
{{/if}}
{{outlet}}

Просмотреть файл

@ -1,25 +0,0 @@
{{#if access_token}}
<fieldset>
<legend>New Token Created:</legend>
<pre>{{access_token}}</pre><br/>
<p>with scopes:</p>
<pre>{{scopes}}</pre>
</fieldset>
{{/if}}
<fieldset>
<legend>Generate an OAuth Bearer Token</legend>
<p>
This page allows you to generate a Firefox Accounts OAuth token with a certain scope. <br/>
<strong>Note: This process will require you to relogin to the OAuth console.</strong>
</p>
<form method="POST" {{action "requestToken" on="submit"}}>
<label>Required Scopes (space separated)
<input type="text" id="scopes" value="profile">
</label>
<button type="submit" class="small button success">Request a New Token</button>
</form>
</fieldset>
{{outlet}}

Просмотреть файл

Просмотреть файл

@ -1,15 +0,0 @@
<div class="row login-panel clearfix">
<div class="large-12 small-centered columns">
<h3>FxA OAuth Credential Management</h3>
<h4>{{server}}</h4>
<img src="assets/firefox.png" alt="Firefox Accounts"/>
<p class="large-4 large-centered columns">
<a href="oauth/login" id="login" class="large button expand">Login with Firefox Accounts</a>
</p>
</div>
</div>
<div data-alert class="alert-box secondary secondary-notification">
To login to this console you must create and verify a Firefox Account on this {{server}} development server.<br/>
Only <strong>@mozilla.com</strong> emails are allowed to login to this console.
</div>
{{outlet}}

Просмотреть файл

Просмотреть файл

@ -1,27 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global require */
const config = require('../lib/config');
const log = require('mozlog')('server');
const updateIndex = require('./updateIndexFromEnv');
/* Update config that's passed into ember app by updating the config built at run-time
* with config values passed in through environment variables.
* This enables re-running the server with newer environment vars
* without having to rebuild ember app.
*/
updateIndex(config)
.then(() => {
const server = require('../lib/server');
const configProps = config.getProperties();
log.debug('Starting with config: %:2j', configProps);
const app = server.listen(configProps.server.port, function() {
const port = app.address().port;
log.info('FxA OAuth Developer Console started on port:', port);
});
})
.catch(err => {
log.info(err);
});

Просмотреть файл

@ -1,109 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global require */
'use strict';
const fs = require('fs');
const path = require('path');
const log = require('mozlog')('server');
const url = require('url');
const indexPath = path.join(__dirname, '..', 'dist', 'index.html');
const META_TAG_PATTERN = /<meta name="fxa-oauth-console\/config\/environment" content="(.*)" \/>/g;
const BASE_URL_TAG_PATTERN = /<base href="\/" \/>/g;
function getConfigFromHtml(html) {
const match = META_TAG_PATTERN.exec(html)[1];
const decodedParsed = decodeURIComponent(match);
return JSON.parse(decodedParsed);
}
function getConfigsFromEnv() {
return {
oauthUri: process.env.OAUTH_URI || undefined,
oauthInternalUri: process.env.OAUTH_INTERNAL_URI || undefined,
profileUri: process.env.PROFILE_URI || undefined,
baseURL: process.env.BASE_URL || undefined,
};
}
function getUriParts(rawUri) {
const uriParsed = url.parse(rawUri);
const uri = `${uriParsed.protocol}//${uriParsed.host}`;
return {
uri,
uriParsed,
};
}
function applyEnvVars(currentConfig, envVars, serverConfig) {
currentConfig.baseURL = envVars.baseURL || currentConfig.baseURL;
const servers = currentConfig.servers;
if (envVars.oauthUri) {
const oauthUriParts = getUriParts(envVars.oauthUri);
servers.oauth = oauthUriParts.uri;
servers.oauthUriParsed = oauthUriParts.uriParsed;
serverConfig.set('fxaOAuth.oauth_uri', envVars.oauthUri);
}
if (envVars.oauthInternalUri) {
const oauthInternalUriParts = getUriParts(envVars.oauthInternalUri);
servers.oauthInternal = oauthInternalUriParts.uri;
servers.oauthInternalUriParsed = oauthInternalUriParts.uriParsed;
serverConfig.set('fxaOAuth.oauth_internal_uri', envVars.oauthInternalUri);
}
if (envVars.profileUri) {
const profileUriParts = getUriParts(envVars.profileUri);
servers.profileUriParsed = profileUriParts.uri;
serverConfig.set('fxaOAuth.profile_uri', envVars.profileUri);
}
return currentConfig;
}
function writeNewIndexHtml(html, configToWrite, baseUrl) {
return new Promise((resolve, reject) => {
const encodedConfig = encodeURIComponent(JSON.stringify(configToWrite));
const newMetaTag = `<meta name="fxa-oauth-console/config/environment" content="${encodedConfig}" />`;
let newHtml = html.replace(META_TAG_PATTERN, newMetaTag);
if (baseUrl) {
const newBaseTag = `<base href="${baseUrl}" />`;
newHtml = newHtml.replace(BASE_URL_TAG_PATTERN, newBaseTag);
}
fs.writeFile(indexPath, newHtml, err => {
if (err) {
reject(err);
}
log.info('Successfully wrote config to index.html');
resolve();
});
});
}
function updateIndex(serverConfig) {
return new Promise((resolve, reject) => {
fs.readFile(indexPath, 'utf8', (err, html) => {
if (err) {
reject(err);
}
const currentConfig = getConfigFromHtml(html);
const envVars = getConfigsFromEnv();
const newConfig = applyEnvVars(currentConfig, envVars, serverConfig);
const baseUrl = process.env.BASE_URL || null;
writeNewIndexHtml(html, newConfig, baseUrl)
.then(() => {
resolve();
})
.catch(err => {
reject(err);
});
});
});
}
module.exports = updateIndex;

Просмотреть файл

@ -1,19 +0,0 @@
{
"name": "fxa-oauth-console",
"dependencies": {
"handlebars": "1.3.0",
"foundation": "zurb/bower-foundation#5.4.5",
"blanket": "1.1.5",
"ember": "2.4.1",
"ember-cli-shims": "0.1.0",
"ember-cli-test-loader": "0.2.2",
"ember-qunit": "0.4.16",
"ember-qunit-notifications": "0.1.0"
},
"devDependencies": {
"fxa-js-client": "0.1.30"
},
"resolutions": {
"jquery": "1.11.3"
}
}

Просмотреть файл

@ -1,17 +0,0 @@
{
"fxaOAuth": {
"client_id": "24bdbfa45cd300c5",
"client_secret": "2be80db1d3cf5ddef69d5e23d7d1885e3bbc09f53781d44a8e2f3507a8d6a62c",
"redirect_uri": "http://127.0.0.1:10137/oauth/redirect",
"oauth_uri": "http://127.0.0.1:9010/v1",
"oauth_internal_uri": "http://127.0.0.1:9010/v1",
"profile_uri": "http://127.0.0.1:1111/v1"
},
"logging": {
"level": "verbose",
"fmt": "pretty"
},
"server": {
"session": "dev"
}
}

Просмотреть файл

@ -1,78 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* jshint node: true */
var url = require('url');
/**
* These is the environment configuration for the front-end application.
* @param environment {String}
* Application environment, such as "development", "production", test"
*/
module.exports = function(environment) {
var config = require('../lib/config');
var oauthUriParsed = url.parse(config.get('fxaOAuth').oauth_uri);
var oauthInternalUriParsed = url.parse(
config.get('fxaOAuth').oauth_internal_uri
);
var profileUriParsed = url.parse(config.get('fxaOAuth').profile_uri);
var baseURL = config.get('base_url');
var oauthUri = oauthUriParsed.protocol + '//' + oauthUriParsed.host;
var oauthInternalUri =
oauthInternalUriParsed.protocol + '//' + oauthInternalUriParsed.host;
var ENV = {
modulePrefix: 'fxa-oauth-console',
'simple-auth': {
authorizer: 'authorizer:custom',
},
servers: {
oauth: oauthUri,
oauthInternal: oauthInternalUri,
oauthUriParsed: oauthUriParsed,
oauthInternalUriParsed: oauthInternalUriParsed,
profileUriParsed: profileUriParsed,
},
environment: environment,
baseURL: baseURL,
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
},
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
},
};
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
ENV.APP.LOG_VIEW_LOOKUPS = true;
}
if (environment === 'test') {
// Testem prefers this...
ENV.baseURL = '/';
ENV.locationType = 'auto';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
}
if (environment === 'production') {
// Production settings go here
}
return ENV;
};

Просмотреть файл

@ -1 +0,0 @@
{}

Просмотреть файл

@ -1,10 +0,0 @@
{
"fxaOAuth": {
"client_id": "24bdbfa45cd300c5",
"client_secret": "2be80db1d3cf5ddef69d5e23d7d1885e3bbc09f53781d44a8e2f3507a8d6a62c",
"redirect_uri": "http://developer.dev.lcip.org/oauth/redirect",
"oauth_uri": "https://oauth-vlad.dev.lcip.org/v1",
"profile_uri": "https://vlad.dev.lcip.org/profile/v1",
"scopes": "profile oauth"
}
}

Просмотреть файл

@ -1,14 +0,0 @@
version: '2.1'
services:
fxa-oauth-console:
build:
context: .
dockerfile: Dockerfile-build
command: node bin/server.js
image: mozilla/fxa-oauth-console
ports:
- '10137:10137'
environment:
PROFILE_URI: http://127.0.0.1:1111/profile/v1
OAUTH_URI: http://127.0.0.1:9010/v1
OAUTH_INTERNAL_URI: http://127.0.0.1:9011/v1

Просмотреть файл

@ -1,27 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
var app = new EmberApp(defaults, {
hinting: false,
// Add options here
});
// Use `app.import` to add additional libraries to the generated
// output files.
//
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.
return app.toTree();
};

Просмотреть файл

@ -1,124 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global require, module, process, __dirname */
const fs = require('fs');
const path = require('path');
const convict = require('convict');
const conf = convict({
/**
* Environment
*/
env: {
arg: 'node-env',
doc: 'The current node.js environment',
env: 'NODE_ENV',
format: ['dev', 'test', 'staging', 'production'],
default: 'dev',
},
git: {
commit: {
doc: 'Commit SHA when in stage/production',
format: String,
default: '',
env: 'GIT_COMMIT_SHA',
},
},
/**
* Server Properties
*/
server: {
host: {
env: 'HOST',
default: '127.0.0.1',
},
port: {
env: 'PORT',
format: 'port',
default: 10137,
},
session: {
env: 'COOKIE_SECRET',
format: String,
default: 'cookie_secret',
},
},
base_url: {
doc: 'Base URL of the application. Note: MUST end with a trailing slash',
format: String,
env: 'BASE_URL',
default: '/',
},
/**
* FxA OAuth
*/
//TODO: update with production settings
fxaOAuth: {
client_id: {
doc: 'The FxA client_id (8 bytes key encoded as hex)',
format: String,
default: '',
env: 'FXA_OAUTH_CLIENT_ID',
},
client_secret: {
doc: 'The FxA client secret (32 bytes key encoded as hex)',
format: String,
default: '',
env: 'FXA_OAUTH_CLIENT_SECRET',
},
oauth_uri: {
doc: 'The location of the FxA OAuth server.',
format: 'url',
default: 'https://127.0.0.1:9010/v1',
env: 'OAUTH_URI',
},
oauth_internal_uri: {
doc: 'The location of the FxA OAuth internal server.',
format: 'url',
default: 'https://127.0.0.1:9011/v1',
env: 'OAUTH_INTERNAL_URI',
},
redirect_uri: {
doc: 'The redirect_uri.',
format: String,
default: 'https://127.0.0.1:10137/oauth/redirect',
env: 'FXA_OAUTH_REDIRECT_URI',
},
profile_uri: {
doc: 'The FxA profile uri.',
format: 'url',
default: 'https://127.0.0.1:1111/profile/v1',
env: 'PROFILE_URI',
},
scopes: {
doc: 'The oauth server scopes',
format: String,
default: 'profile oauth',
env: 'FXA_OAUTH_SCOPES',
},
},
/**
* Logging
*/
logging: {
default: {
app: 'fxa-oauth-console',
},
},
});
var envConfig = path.join(__dirname, '..', 'config', conf.get('env') + '.json');
var files = (envConfig + ',' + process.env.CONFIG_FILES)
.split(',')
.filter(fs.existsSync);
conf.loadFile(files);
require('mozlog').config(conf.get('logging'));
process.env.NODE_ENV = conf.get('env');
conf.validate();
module.exports = conf;

Просмотреть файл

@ -1,6 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global require, module */
module.exports = require('bluebird');

Просмотреть файл

@ -1,68 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global require, module */
var request = require('request');
var config = require('../../config');
var fxaOAuthConfig = config.get('fxaOAuth');
/**
* Query to qtring helper
* @param {Object} obj
* @returns {string}
*/
function toQueryString(obj) {
var fields = Object.keys(obj).map(function(key) {
return key + '=' + obj[key];
});
return '?' + fields.join('&');
}
/**
* Constructs an FxA OAuth redirect url
*
* @param {String} action
* @param {String} nonce
* @param {String} scopes
* @returns {string} Returns a string to redirect to.
*/
function redirectUrl(action, nonce, scopes) {
var oauthParams = {
client_id: fxaOAuthConfig.client_id,
redirect_uri: fxaOAuthConfig.redirect_uri,
state: nonce,
scope: scopes || fxaOAuthConfig.scopes,
action: action,
};
return (
fxaOAuthConfig.oauth_uri + '/authorization' + toQueryString(oauthParams)
);
}
/**
* Request the bearer token from the OAuth server
* @param {String}code
* @param {Function} cb
*/
function requestToken(code, cb) {
request.post(
{
uri: fxaOAuthConfig.oauth_uri + '/token',
json: {
code: code,
client_id: fxaOAuthConfig.client_id,
client_secret: fxaOAuthConfig.client_secret,
},
},
cb
);
}
module.exports = {
redirectUrl: redirectUrl,
requestToken: requestToken,
};

Просмотреть файл

@ -1,233 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global require, module */
var express = require('express');
var crypto = require('crypto');
var request = require('request');
var Promise = require('bluebird');
var router = express.Router();
var redirectUrl = require('./lib/oauth').redirectUrl;
var requestToken = require('./lib/oauth').requestToken;
var config = require('../config');
var baseUrl = config.get('base_url');
var fxaOAuthConfig = config.get('fxaOAuth');
var log = require('mozlog')('server.oauth');
// oauth flows are stored in memory
var oauthFlows = {};
var GENERATE_OAUTH_TOKEN_STATE = 'GENERATE_OAUTH_TOKEN';
var DIFFERENT_BROWSER_ERROR = 3005;
/**
* OAuth Login, redirects to FxA
*/
router.get('/login', function(req, res) {
var nonce = crypto.randomBytes(32).toString('hex');
oauthFlows[nonce] = true;
req.session.state = nonce;
return res.redirect(redirectUrl('signin', nonce));
});
/**
* Session Status
*/
router.get('/status', function(req, res) {
if (req.session && req.session.email) {
return res.send(
JSON.stringify({
email: req.session.email,
token: req.session.token,
})
);
} else {
return res.status(401).end();
}
});
/**
* Clears local session
*/
router.get('/logout', function(req, res) {
req.session.reset();
res.redirect(baseUrl);
});
/**
* Generates an OAuth Token based on scope
*/
router.post('/generate-token', function(req, res) {
log.verbose('/generate-token', req.body);
if (req.body.scopes) {
return res.redirect(
redirectUrl('signin', GENERATE_OAUTH_TOKEN_STATE, req.body.scopes)
);
} else {
return res.redirect(baseUrl + 'clients/token');
}
});
/**
* OAuth redirect flow, redirects from FxA
*/
router.get('/redirect', function(req, res) {
var state = req.query.state;
var code = req.query.code;
var error = parseInt(req.query.error, 10);
// The user finished the flow in a different browser.
// Prompt them to log in again
if (error === DIFFERENT_BROWSER_ERROR) {
return res.redirect(baseUrl + '?oauth_incomplete=true');
}
if (state && state === GENERATE_OAUTH_TOKEN_STATE) {
requestToken(code, function(err, r, body) {
if (err) {
return res.send(400, err);
}
log.verbose(GENERATE_OAUTH_TOKEN_STATE, body);
return res.redirect(
baseUrl +
'clients/token?' +
'access_token=' +
body.access_token +
'&scopes=' +
body.scope
);
});
} else if (
code &&
state &&
state in oauthFlows &&
state === req.session.state
) {
// state should exists in our set of active flows and the user should
// have a cookie with that state
delete oauthFlows[state];
delete req.session.state;
requestToken(code, function(err, r, body) {
if (err) {
return res.send(r.status, err);
}
log.verbose(err, body);
req.session.scope = body.scope;
req.session.token_type = body.token_type;
var token = (req.session.token = body.access_token);
var profile;
requestProfile(token)
.then(function(profileData) {
profile = profileData;
return activateDeveloper(token);
})
.done(
function(developer) {
// only allow login if developer id is available
if (developer && developer.developerId && profile.email) {
req.session.email = profile.email;
req.session.uid = profile.uid;
req.session.token = token;
req.session.developerId = developer.developerId;
}
return res.redirect(baseUrl);
},
function(response) {
var msg = 'Error: Developer cannot be validated or activated';
return res.status(response.status).send(msg);
}
);
});
} else if (req.session.email) {
// already logged in
return res.redirect(baseUrl);
} else {
var msg = 'Bad request ';
if (!code) {
msg += ' - missing code';
}
if (!state) {
msg += ' - missing state';
} else if (!oauthFlows[state]) {
msg += ' - unknown state';
} else if (state !== req.session.state) {
msg += " - state cookie doesn't match";
}
log.error('msg', msg);
return res.send(400, msg);
}
});
/**
* Request user profile
*
* @param {String} token
* @returns {Promise}
*/
function requestProfile(token) {
return new Promise(function(resolve, reject) {
request.get(
{
uri: fxaOAuthConfig.profile_uri + '/profile',
headers: {
Authorization: 'Bearer ' + token,
},
json: true,
},
function(err, r, body) {
log.verbose(err, body);
if (err || r.statusCode >= 400) {
return reject({ status: 400, err: err || body });
}
return resolve({
email: body.email,
uid: body.uid,
});
}
);
});
}
/**
* Activate the developer
*
* @param {String} token
* @returns {Promise}
*/
function activateDeveloper(token) {
return new Promise(function(resolve, reject) {
request.post(
{
uri: fxaOAuthConfig.oauth_internal_uri + '/developer/activate',
headers: {
Authorization: 'Bearer ' + token,
},
json: true,
},
function(err, r, body) {
log.verbose(err, body);
if (err || r.statusCode >= 400) {
return reject({ status: 400, err: err });
}
log.verbose('developerData', body);
return resolve(body);
}
);
});
}
module.exports = router;

Просмотреть файл

@ -1,111 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global require, module, __dirname */
var express = require('express');
var router = express.Router();
/**
* Return version info based on package.json and the git hash
*
* We figure out the Git hash in the following order:
*
* (1) read config/version.json if exists (ie. staging, production)
* (2) figure it out from git (either regular '.git', or
* '/home/app/git' for AwsBox)
*/
var fs = require('fs');
var path = require('path');
var util = require('util');
var child_process = require('child_process');
var Promise = require('bluebird');
var logger = require('mozlog')('server.ver.json');
var version = require('../../package.json').version;
function getCommitHashFromVersionJson() {
return Promise.attempt(function() {
var configFile = path.join(__dirname, '..', '..', 'config', 'version.json');
if (fs.existsSync(configFile)) {
var commitHash;
try {
commitHash = require(configFile).version.hash;
} catch (e) {
logger.error('could not read version.hash from version.json');
}
return commitHash;
}
});
}
function getGitDir() {
if (!fs.existsSync(path.join(__dirname, '..', '..', '.git'))) {
// try at '/home/app/git' for AwsBox deploys
return path.sep + path.join('home', 'app', 'git');
}
}
function getCommitHashFromGit() {
var deferred = Promise.defer();
var gitDir = getGitDir();
var cmd = util.format(
'git %s rev-parse HEAD',
gitDir ? '--git-dir=' + gitDir : ''
);
child_process.exec(cmd, function(err, stdout) {
//eslint-disable-line handle-callback-err
deferred.resolve(stdout.replace(/\s+/, ''));
});
return deferred.promise;
}
var promise;
function getVersionInfo() {
// only resolve once, the data does not need to be re-calculated.
if (promise) {
return promise;
}
// (1) read config/version.json if exists (ie. staging, production)
promise = getCommitHashFromVersionJson()
.then(function(commitHash) {
if (commitHash) {
return commitHash;
}
// (2) figure it out from git (either regular '.git',
// or '/home/app/git' for AwsBox)
return getCommitHashFromGit();
})
.then(function(commitHash) {
logger.info('version set to: %s', version);
logger.info('commit hash set to: %s', commitHash);
return {
version: version,
commit: commitHash,
};
});
return promise;
}
// seed the info on startup.
getVersionInfo();
/**
* OAuth Login, redirects to FxA
*/
router.get('*', function(req, res) {
getVersionInfo().then(function(versionInfo) {
// charset must be set on json responses.
res.charset = 'utf-8';
res.json(versionInfo);
});
});
module.exports = router;

Просмотреть файл

@ -1,59 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global require, module, __dirname */
const express = require('express');
const path = require('path');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const routesOAuth = require('./routes/oauth');
const routesVersion = require('./routes/ver');
const session = require('./session');
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(session);
app.use('/oauth', routesOAuth);
app.use('/ver.json', routesVersion);
app.use(express.static(path.join(__dirname, '..', 'dist')));
// TODO: there should be a better way to do send through requested routes with pushState
app.get('/*', function(req, res) {
res.sendFile(path.join(__dirname, '..', 'dist', 'index.html'));
});
// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
// error handlers
// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function(err, req, res) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: err,
});
});
}
// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: {},
});
});
module.exports = app;

Просмотреть файл

@ -1,32 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global require, module */
var sessions = require('client-sessions');
var conf = require('./config');
var baseUrl = conf.get('base_url');
var sessionSecret = conf.get('server').session;
if (!sessionSecret) {
throw new Error('Session secret not configured.');
}
module.exports = function(req, res, next) {
if (/^\/oauth/.test(req.url)) {
res.setHeader('Cache-Control', 'no-cache, max-age=0');
return sessions({
cookieName: 'fxa-oauth-console',
secret: sessionSecret,
requestKey: 'session',
cookie: {
path: baseUrl + 'oauth',
httpOnly: true,
},
})(req, res, next);
} else {
return next();
}
};

13503
packages/fxa-oauth-console/package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,77 +0,0 @@
{
"name": "fxa-oauth-console",
"version": "0.5.1",
"description": "Firefox Accounts OAuth Credential Management Dashboard",
"scripts": {
"start": "./scripts/run_dev.js",
"production": "NODE_ENV=production ember build --environment=production && node bin/server.js",
"build": "NODE_ENV=production ember build --environment=production",
"test": "ember test && grunt lint",
"postinstall": "node_modules/.bin/bower install --config.interactive=false -s --allow-root",
"outdated": "npm outdated --depth 0",
"contributors": "git shortlog -s | cut -c8- | sort -f > CONTRIBUTORS",
"format": "prettier '**' --write"
},
"repository": {
"type": "git",
"url": "https://github.com/mozilla/fxa.git"
},
"homepage": "https://github.com/mozilla/fxa/tree/master/packages/fxa-oauth-console",
"bugs": "https://github.com/mozilla/fxa/issues",
"author": "Mozilla (https://mozilla.org/)",
"license": "MPL-2.0",
"dependencies": {
"bluebird": "2.3.11",
"body-parser": "1.18.2",
"bower": "*",
"broccoli-asset-rev": "^2.1.2",
"broccoli-ember-hbs-template-compiler": "1.7.0",
"broccoli-sass": "udaraweerasinghege/broccoli-sass#02dfa0ae15409ad1762d4dfc65c9f7998ea648bd",
"client-sessions": "0.7.0",
"convict": "1.5.0",
"cookie-parser": "1.4.3",
"ember-cli": "2.4.0",
"ember-cli-sri": "~2.0.0",
"ember-cli-app-version": "1.0.0",
"ember-load-initializers": "~0.5.0",
"ember-cli-babel": "5.1.10",
"ember-resolver": "~2.0.3",
"ember-cli-dependency-checker": "~1.2.0",
"ember-cli-content-security-policy": "0.4.0",
"ember-cli-htmlbars": "1.0.1",
"ember-cli-htmlbars-inline-precompile": "0.3.1",
"ember-cli-inject-live-reload": "1.3.1",
"ember-data": "2.4.0",
"ember-ajax": "0.7.1",
"ember-disable-proxy-controllers": "1.0.1",
"ember-export-application-global": "1.0.4",
"ember-simple-auth": "1.2.0",
"express": "4.15.5",
"glob": "7.1.1",
"mozlog": "2.0.6",
"loader.js": "~4.0.0",
"request": "2.79.0"
},
"devDependencies": {
"ember-cli-qunit": "1.2.1",
"ember-cli-release": "0.2.8",
"ember-cli-uglify": "1.2.0",
"eslint-config-prettier": "^5.0.0",
"grunt": "^1.0.1",
"grunt-cli": "^1.2.0",
"grunt-concurrent": "^2.3.1",
"grunt-contrib-jshint": "1.1.0",
"grunt-copyright": "0.3.0",
"grunt-eslint": "21.1.0",
"load-grunt-tasks": "3.5.2",
"natives": "1.1.6",
"nodemon": "^1.2.1",
"prettier": "^1.18.2",
"xmlhttprequest": "git://github.com/zaach/node-XMLHttpRequest.git#onerror"
},
"engines": {
"node": ">=4.5.0",
"npm": ">=2.4"
},
"readmeFilename": "README.md"
}

Просмотреть файл

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше