Add support for Starship CoreID login (#9)
This commit is contained in:
parent
b5b2a7cd85
commit
574d6ae22a
@ -1,6 +1,6 @@
|
|||||||
html
|
html
|
||||||
head
|
head
|
||||||
title Flitter
|
title Login | #{_app.name}
|
||||||
meta(name="viewport" content="width=device-width, initial-scale=1")
|
meta(name="viewport" content="width=device-width, initial-scale=1")
|
||||||
link(rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous")
|
link(rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous")
|
||||||
script(src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous")
|
script(src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous")
|
||||||
@ -73,19 +73,23 @@ html
|
|||||||
a.btn.btn-login.btn-light(href="/auth/flitter/login")
|
a.btn.btn-login.btn-light(href="/auth/flitter/login")
|
||||||
i.icons.fas.fa-sign-in-alt
|
i.icons.fas.fa-sign-in-alt
|
||||||
span Local Login
|
span Local Login
|
||||||
|
div
|
||||||
|
a.btn.btn-login.btn-light(href="/auth/starship_oauth/login")
|
||||||
|
i.icons.fas.fa-rocket
|
||||||
|
span Login with Starship CoreID
|
||||||
div
|
div
|
||||||
a.btn.btn-login.btn-light(href="/auth/github_oauth/login")
|
a.btn.btn-login.btn-light(href="/auth/github_oauth/login")
|
||||||
i.icons.fab.fa-github
|
i.icons.fab.fa-github
|
||||||
span Login with GitHub
|
span Login with GitHub
|
||||||
div
|
//div
|
||||||
a.btn.btn-login.btn-light.disabled(href="google.com")
|
a.btn.btn-login.btn-light.disabled(href="google.com")
|
||||||
i.icons.fab.fa-google
|
i.icons.fab.fa-google
|
||||||
span Login with Google
|
span Login with Google
|
||||||
div
|
//div
|
||||||
a.btn.btn-login.btn-light.disabled(href="microsoft.com")
|
a.btn.btn-login.btn-light.disabled(href="microsoft.com")
|
||||||
i.icons.fab.fa-microsoft
|
i.icons.fab.fa-microsoft
|
||||||
span Login with Microsoft
|
span Login with Microsoft
|
||||||
div
|
//div
|
||||||
a.btn.btn-login.btn-light.disabled(href="apple.com")
|
a.btn.btn-login.btn-light.disabled(href="apple.com")
|
||||||
i.icons.fab.fa-apple
|
i.icons.fab.fa-apple
|
||||||
span Login with Apple
|
span Login with Apple
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
html
|
html
|
||||||
head
|
head
|
||||||
title Flitter
|
title Welcome | #{_app.name}
|
||||||
style(type="text/css").
|
style(type="text/css").
|
||||||
@import url('https://fonts.googleapis.com/css?family=Rajdhani');
|
@import url('https://fonts.googleapis.com/css?family=Rajdhani');
|
||||||
html,
|
html,
|
||||||
@ -22,7 +22,7 @@ html
|
|||||||
}
|
}
|
||||||
|
|
||||||
.flitter-name {
|
.flitter-name {
|
||||||
font-family: "Rajdhani";
|
font-family: "Rajdhani", sans-serif;
|
||||||
font-size: 50pt;
|
font-size: 50pt;
|
||||||
margin-left: 35px;
|
margin-left: 35px;
|
||||||
color: #00323d;
|
color: #00323d;
|
||||||
@ -30,7 +30,7 @@ html
|
|||||||
}
|
}
|
||||||
|
|
||||||
.flitter-text {
|
.flitter-text {
|
||||||
font-family: "Rajdhani";
|
font-family: "Rajdhani", sans-serif;
|
||||||
font-size: 24pt;
|
font-size: 24pt;
|
||||||
color: #00323d;
|
color: #00323d;
|
||||||
}
|
}
|
||||||
@ -43,4 +43,4 @@ html
|
|||||||
p.flitter-text Welcome, #{user.uid}! <a href="/auth/logout">Log out.</a>
|
p.flitter-text Welcome, #{user.uid}! <a href="/auth/logout">Log out.</a>
|
||||||
else
|
else
|
||||||
.flitter-container
|
.flitter-container
|
||||||
p.flitter-text New to #{_app.name}? <a href="/login" target="_blank">Start here.</a>
|
p.flitter-text New to #{_app.name}? <a href="/login">Start here.</a>
|
||||||
|
@ -98,6 +98,76 @@ const auth_config = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
starship_oauth: {
|
||||||
|
type: 'Oauth2Provider',
|
||||||
|
enable: env('AUTH_COREID_ENABLE', false),
|
||||||
|
|
||||||
|
source_name: env('AUTH_COREID_SOURCE_NAME', 'Starship CoreID'),
|
||||||
|
source_client_id: env('AUTH_COREID_CLIENT_ID'),
|
||||||
|
source_client_secret: env('AUTH_COREID_CLIENT_SECRET'),
|
||||||
|
|
||||||
|
// Login page destination where the user will be redirected to on login
|
||||||
|
// %c will be interpolated with the client id
|
||||||
|
// %r will be interpolated with the redirect callback url
|
||||||
|
// NOTE: This url is the same as the login page - /auth/oauth2/login
|
||||||
|
source_login_page: env('AUTH_COREID_LOGIN_REDIRECT', 'https://coreid.garrettmills.dev/auth/service/oauth2/authorize?client_id=%c&redirect_uri=%r'),
|
||||||
|
|
||||||
|
// Information about the OAuth2 Callback
|
||||||
|
callback: {
|
||||||
|
// URL query parameter name with the authorization_code token
|
||||||
|
// e.g. ?code=XXXXXXXXXX
|
||||||
|
token_key: 'code',
|
||||||
|
},
|
||||||
|
|
||||||
|
// Information about the endpoint flitter-auth will use to redeem
|
||||||
|
// the authorization_code token for a bearer token
|
||||||
|
source_token: {
|
||||||
|
endpoint: 'https://coreid.garrettmills.dev/auth/service/oauth2/redeem',
|
||||||
|
|
||||||
|
// Field name where the authorization_code token will be specified in the request
|
||||||
|
token_key: 'code',
|
||||||
|
|
||||||
|
// Field name for the client id
|
||||||
|
client_id_key: 'client_id',
|
||||||
|
|
||||||
|
// Field name for the client secret
|
||||||
|
client_secret_key: 'client_secret',
|
||||||
|
|
||||||
|
// Field name for the grant_type ('authorization_type')
|
||||||
|
grant_type_key: 'grant_type',
|
||||||
|
|
||||||
|
// Field name where the bearer token will be specified in the response
|
||||||
|
response_token_key: 'access_token',
|
||||||
|
},
|
||||||
|
|
||||||
|
// Information about the endpoint flitter-auth will use to get
|
||||||
|
// user information after it retrieves a bearer token
|
||||||
|
user_data: {
|
||||||
|
endpoint: 'https://coreid.garrettmills.dev/api/v1/auth/users/me',
|
||||||
|
method: 'get', // 'get' or 'post' only
|
||||||
|
|
||||||
|
// In the response data, what key is the user data in?
|
||||||
|
// e.g. if 'data', then {'data': { ... }}
|
||||||
|
// Set falsy to assume the data exists in the root: { ... }
|
||||||
|
data_root: 'data',
|
||||||
|
|
||||||
|
// Value that prefixes the token in the 'Authorization: ' header.
|
||||||
|
// e.g. 'token ' would mean 'token a0fw93ja0w93ja093wj'
|
||||||
|
// 'Bearer ' would be 'Bearer 0329j0239dj209j3209jd'
|
||||||
|
// token_prefix: 'token ',
|
||||||
|
|
||||||
|
// Mapping of user model attributes to OAuth2 return data from the endpoint
|
||||||
|
// Note that uuid is not allowed, and uid is required
|
||||||
|
attributes: {
|
||||||
|
uid: 'username',
|
||||||
|
first_name: 'first_name',
|
||||||
|
last_name: 'last_name',
|
||||||
|
email: 'email',
|
||||||
|
roles: 'group_ids',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
github_oauth: {
|
github_oauth: {
|
||||||
type: 'Oauth2Provider',
|
type: 'Oauth2Provider',
|
||||||
enable: env('AUTH_OAUTH2_ENABLE', true),
|
enable: env('AUTH_OAUTH2_ENABLE', true),
|
||||||
|
@ -22,3 +22,8 @@ AUTH_FLITTER_ENABLE=true
|
|||||||
#insert client ID for oauth
|
#insert client ID for oauth
|
||||||
AUTH_OAUTH2_CLIENT_ID=
|
AUTH_OAUTH2_CLIENT_ID=
|
||||||
AUTH_OAUTH2_CLIENT_SECRET=
|
AUTH_OAUTH2_CLIENT_SECRET=
|
||||||
|
|
||||||
|
#starship coreid login config
|
||||||
|
AUTH_COREID_ENABLE=true
|
||||||
|
AUTH_COREID_CLIENT_ID=
|
||||||
|
AUTH_COREID_CLIENT_SECRET=
|
Loading…
Reference in New Issue
Block a user