Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #11 from ikedam/feature/JENKINS-22470_SupportsApiT…
…oken [JENKINS-22470] Supports apitoken for authentication.
- Loading branch information
Showing
7 changed files
with
327 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...i/plugins/authorizeproject/strategy/SpecificUsersAuthorizationStrategy/help-password.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
<div> | ||
Password of the user specified in User ID. | ||
This field is shown only when authentication is required for this user. | ||
<p> | ||
You can use API token for authentication instead by checking "Use API Token for authentication". | ||
You can get your API token from your user configuration page. | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...lugins/authorizeproject/strategy/SpecificUsersAuthorizationStrategy/help-password_ja.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
<div> | ||
ユーザーID で指定したユーザーのパスワード。 | ||
このフィールドは認証が必要な場合にだけ表示されます。 | ||
<p> | ||
「認証に API トークンを使用する」にチェックをいれるとパスワードの代わりに API トークンで認証できます。 | ||
API トークンはユーザーの設定画面から確認できます。 | ||
</div> |
60 changes: 60 additions & 0 deletions
60
...ns/authorizeproject/strategy/SpecificUsersAuthorizationStrategy/passwordApiTokenSwitch.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2015 IKEDA Yasuyuki | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
/** | ||
* Swtich password and ApiToken | ||
*/ | ||
Behaviour.specify(".specific-user-authorization", "passwordApiTokenSwitch", 0, function (e) { | ||
var findChild = function(startNode) { | ||
return function(src,filter) { | ||
return find(src,filter,function (e) { | ||
if (e.firstChild != null) { | ||
return e.firstChild; | ||
} | ||
while (e != null && e != startNode && e.nextSibling == null) { | ||
e = e.parentNode | ||
} | ||
if (e == null || e == startNode) { | ||
return null; | ||
} | ||
return e.nextSibling; | ||
}); | ||
}; | ||
}; | ||
|
||
var onchange = function() { | ||
var e = this.up(".specific-user-authorization"); | ||
if (this.checked) { | ||
e.down('.specific-user-authorization-password').hide(); | ||
e.down('.specific-user-authorization-apitoken').show(); | ||
} else { | ||
e.down('.specific-user-authorization-password').show(); | ||
e.down('.specific-user-authorization-apitoken').hide(); | ||
} | ||
}; | ||
|
||
var useApitokenField = findFormItem(e, "useApitoken", findChild(e)); | ||
useApitokenField.observe("click", onchange); | ||
onchange.call(useApitokenField); | ||
}); |
Oops, something went wrong.