1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-05 05:25:27 +02:00

updated is.js, refactored jwt code

This commit is contained in:
Harvey Kandola 2017-03-16 13:33:34 +00:00
parent 74c9e76d09
commit a585a55033
8 changed files with 751 additions and 620 deletions

View file

@ -23,10 +23,12 @@ export default Ember.Component.extend({
KeycloakUrlError: computed.empty('keycloakConfig.url'),
KeycloakRealmError: computed.empty('keycloakConfig.realm'),
KeycloakClientIdError: computed.empty('keycloakConfig.clientId'),
KeycloakPublicKeyError: computed.empty('keycloakConfig.publicKey'),
keycloakConfig: {
url: '',
realm: '',
clientId: ''
clientId: '',
publicKey: '',
},
didReceiveAttrs() {
@ -81,6 +83,20 @@ export default Ember.Component.extend({
this.$("#keycloak-clientId").focus();
return;
}
if (this.get('KeycloakPublicKeyError')) {
this.$("#keycloak-publicKey").focus();
return;
}
let pk = this.get('keycloakConfig.publicKey');
if (is.not.startWith(pk, '-----BEGIN PUBLIC KEY-----')) {
pk = '-----BEGIN PUBLIC KEY-----' + pk;
}
if (is.not.endWith(pk, '-----END PUBLIC KEY-----')) {
pk = pk + '-----END PUBLIC KEY-----' ;
}
this.set('keycloakConfig.publicKey', pk);
config = this.get('keycloakConfig');
break;

View file

@ -44,6 +44,8 @@ export default Ember.Route.extend({
this.get('kcAuth').fetchProfile(kc).then((profile) => {
let data = this.get('kcAuth').mapProfile(kc, profile);
console.log(kc);
console.log(profile);
console.log(data);
// this.get("session").authenticate('authenticator:keycloak', data)

View file

@ -1,4 +1,4 @@
<div class="sso-box">
<p>Keycloak authentication...</p>
<p>Authenticating with Keycloak...</p>
<img src="/assets/img/busy-gray.gif" />
</div>

View file

@ -69,6 +69,7 @@ export default Ember.Service.extend({
username: profile.username,
firstname: profile.firstName,
lastname: profile.lastName,
remoteId: profile.id
};
}
});

View file

@ -11,6 +11,10 @@
</div>
{{#if isKeycloakProvider}}
<div class="form-header">
<div class="title">Keycloak Configuration</div>
<div class="tip">Connection parameters</div>
</div>
<div class="input-control">
<label>Keycloak Server URL</label>
<div class="tip">e.g. http://localhost:8888/auth</div>
@ -26,6 +30,11 @@
<div class="tip">e.g. account</div>
{{input id="keycloak-clientId" type="text" value=keycloakConfig.clientId class=(if KeycloakClientIdError 'error')}}
</div>
<div class="input-control">
<label>Keycloak Realm Public Key</label>
<div class="tip">Copy the RSA public key from Realm Settings &rarr; Keys</div>
{{textarea id="keycloak-publicKey" type="text" value=keycloakConfig.publicKey rows=7 class=(if KeycloakPublicKeyError 'error')}}
</div>
{{/if}}
<div class="regular-button button-blue" {{action 'onSave'}}>save</div>

1054
app/vendor/is.js vendored

File diff suppressed because it is too large Load diff