Skip to content

Commit

Permalink
Add default to dist file (#621)
Browse files Browse the repository at this point in the history
Add token based authentication

The login of Jira changes from basic auth to token login. This change implements this change.
  • Loading branch information
parijke committed Feb 13, 2024
1 parent 125df06 commit 6acbb20
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
5 changes: 2 additions & 3 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ [email protected]
jira_test_mode_storage_path='../var/issues.json'

# Jira settings
JIRA_HOST='https://jira.example.com'
JIRA_USER=sp-dashboard
JIRA_PASS=secret
jira_host='https://your_jira_host.nl'
jira_personal_access_token='your_jira_personal_access_token'

# Jira default issue settings
jira_issue_priority=Medium
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,7 @@ services:
Surfnet\ServiceProviderDashboard\Infrastructure\Jira\Factory\JiraServiceFactory:
arguments:
- '%env(jira_host)%'
- '%env(jira_username)%'
- '%env(jira_password)%'
- '%env(jira_personal_access_token)%'
- '@logger'

Surfnet\ServiceProviderDashboard\Infrastructure\DashboardBundle\Form\Entity\AclListType:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,22 @@

class JiraServiceFactory
{
/**
* @var ArrayConfiguration
*/
private $config;
private ArrayConfiguration $config;

public function __construct(
string $host,
string $username,
string $password,
string $personalAccessToken,
private readonly LoggerInterface $logger
) {
// Create a IssueService with a Jira connection built in.
$this->config = new ArrayConfiguration([
'jiraHost' => $host,
'jiraUser' => $username,
'jiraPassword' => $password
'useTokenBasedAuth' => true,
'personalAccessToken' => $personalAccessToken,
]);
}

public function buildIssueService()
public function buildIssueService(): IssueService
{
return new IssueService($this->config, $this->logger);
}
Expand Down

0 comments on commit 6acbb20

Please sign in to comment.