Skip to content

Commit

Permalink
fixed cservakt suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
feyruzb committed Sep 3, 2024
1 parent a9713c9 commit bdbd6b6
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 19 deletions.
4 changes: 4 additions & 0 deletions web/client/codechecker_client/helpers/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def performLogin(self, auth_method, auth_string):
def createLink(self, provider):
pass

@thrift_client_call
def getOauthProviders(self):
pass

@thrift_client_call
def destroySession(self):
pass
Expand Down
2 changes: 0 additions & 2 deletions web/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ gitpython==3.1.41
PyYAML==6.0.1
types-PyYAML==6.0.12.12
sarif-tools==1.0.0
Authlib==1.3.1
requests==2.32.3

./api/py/codechecker_api/dist/codechecker_api.tar.gz
./api/py/codechecker_api_shared/dist/codechecker_api_shared.tar.gz
2 changes: 2 additions & 0 deletions web/requirements_py/auth/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
python-ldap==3.4.0
python-pam==1.8.4
Authlib==1.3.1
requests==2.32.3
66 changes: 49 additions & 17 deletions web/server/vue-cli/src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,52 @@
>
Login
</v-btn>
<v-btn
v-for="provider in providers"
:id="login-btn-{provider}"
:key="provider"
<v-btn
block
x-large
color="primary"
@click="oauth(provider)"
@click="openModal"
>
Login with {{ provider }}
OAuth login
</v-btn>
</v-card-actions>
</v-card>
</v-col>
</v-row>
<v-dialog
v-model="dialog"
width="500"
:scrollable="true"
>
<v-card>
<v-card-title
class="headline primary white--text"
primary-title
>
OAuth Login Methods

<v-spacer />

<v-btn icon dark @click="dialog = false">
<v-icon>mdi-close</v-icon>
</v-btn>
</v-card-title>
<v-card-text>
<v-btn
v-for="provider in providers"
:id="login-btn-{provider}"
:key="provider"
block
x-large
color="primary"
style="margin-top: 10px"
@click="oauth(provider)"
>
Login with {{ provider }}
</v-btn>
</v-card-text>
</v-card>
</v-dialog>
</v-container>
</template>

Expand All @@ -109,7 +140,10 @@ export default {
error: false,
errorMsg: null,
valid: false,
providers: []
providers: [],
dialog: false,
on: false,
test : "GFGDFG"
};
},
Expand Down Expand Up @@ -141,6 +175,10 @@ export default {
},
methods: {
openModal() {
this.dialog = true;
this.on = true;
},
login() {
if (!this.valid) return;
Expand All @@ -158,16 +196,10 @@ export default {
});
},
detectCallback() {
const url = new URL(window.location.href);
let code = null, state = null;
code = url.searchParams.get("code");
state = url.searchParams.get("state");
const provider = document.cookie.split(";").find(
c => c.includes("oauth_provider")).split("=")[1];
const url = this.$route.query;
const provider = localStorage.getItem("oauth_provider");
if (code != null && state != null) {
if (url.code != null && url.state != null) {
this.$store
.dispatch(LOGIN, {
type: "oauth",
Expand Down Expand Up @@ -204,7 +236,7 @@ export default {
},
oauth(provider) {
new Promise(resolve => {
document.cookie = `oauth_provider=${provider}; path=*`;
localStorage.setItem("oauth_provider", provider);
// console output the provider for debugging
authService.getClient().createLink(provider,
handleThriftError(url => {
Expand Down

0 comments on commit bdbd6b6

Please sign in to comment.