Skip to main content

Class: JiraStrategyService

strategies/jira/jira.service.JiraStrategyService

Hierarchy​

Constructors​

constructor​

• new JiraStrategyService(strategiesService, strategyInstanceService, loginDataService, passportJwtService, activeLoginService)

Parameters​

NameType
strategiesServiceStrategiesService
strategyInstanceServiceStrategyInstanceService
loginDataServiceUserLoginDataService
passportJwtServiceJwtService
activeLoginServiceActiveLoginService

Overrides​

StrategyUsingPassport.constructor

Defined in​

login-service/src/strategies/jira/jira.service.ts:18

Properties​

activeLoginService​

• Private Readonly activeLoginService: ActiveLoginService

Defined in​

login-service/src/strategies/jira/jira.service.ts:24


allowsImplicitSignup​

• Readonly allowsImplicitSignup: boolean = false

Inherited from​

StrategyUsingPassport.allowsImplicitSignup

Defined in​

login-service/src/strategies/Strategy.ts:27


canLoginRegister​

• Readonly canLoginRegister: boolean = true

Inherited from​

StrategyUsingPassport.canLoginRegister

Defined in​

login-service/src/strategies/Strategy.ts:24


canSync​

• Readonly canSync: boolean = false

Inherited from​

StrategyUsingPassport.canSync

Defined in​

login-service/src/strategies/Strategy.ts:25


loggerJira​

• Private Readonly loggerJira: Logger

Defined in​

login-service/src/strategies/jira/jira.service.ts:17


loginDataService​

• Private Readonly loginDataService: UserLoginDataService

Defined in​

login-service/src/strategies/jira/jira.service.ts:21


needsRedirectFlow​

• Readonly needsRedirectFlow: boolean = false

Inherited from​

StrategyUsingPassport.needsRedirectFlow

Defined in​

login-service/src/strategies/Strategy.ts:26


passportJwtService​

• Protected Readonly passportJwtService: JwtService

Inherited from​

StrategyUsingPassport.passportJwtService

Defined in​

login-service/src/strategies/StrategyUsingPassport.ts:16


strategiesService​

• Protected Readonly strategiesService: StrategiesService

Inherited from​

StrategyUsingPassport.strategiesService

Defined in​

login-service/src/strategies/Strategy.ts:23


strategyInstanceService​

• Protected Readonly strategyInstanceService: StrategyInstanceService

Inherited from​

StrategyUsingPassport.strategyInstanceService

Defined in​

login-service/src/strategies/Strategy.ts:22


typeName​

• Readonly typeName: string

Inherited from​

StrategyUsingPassport.typeName

Defined in​

login-service/src/strategies/Strategy.ts:21

Accessors​

acceptsVariables​

• get acceptsVariables(): Object

Returns​

Object

Inherited from​

StrategyUsingPassport.acceptsVariables

Defined in​

login-service/src/strategies/Strategy.ts:131

Methods​

checkAndExtendInstanceConfig​

▸ Protected checkAndExtendInstanceConfig(instanceConfig): object

Chechs the given config is valid for a jira (or jira enterprise)

Needed parameters

  • imsTemplatedFieldsFilter containing:
  • authorizationUrl: Oauth authorization URL. Optional, default: "https://jira.com/login/oauth/authorize"
  • tokenUrl: Oauth token url. Optional, default: "https://jira.com/login/oauth/access_token"
  • userProfileUrl: API URL to request user profile info from. Needs to be specified for GitHib Enterprise instances. Optional
  • clientId: Id of Jira oauth app. Optional, default: GROPIUS_OAUTH_CLIENT_ID config variable
  • clientSecret: secret of Jira oaut app. Optional, default: GROPIUS_OAUTH_CLIENT_SECRET config value
  • callbackUrl: Oauth callback url. Should be [URL]/authenticate/:id/callback. Optional, default empty

Parameters​

NameTypeDescription
instanceConfigobjectThe instance config for a jira strategy instance to check

Returns​

object

The extended config (with default parameters for the global jira) if check successful

Overrides​

StrategyUsingPassport.checkAndExtendInstanceConfig

Defined in​

login-service/src/strategies/jira/jira.service.ts:46


createOrUpdateNewInstance​

▸ createOrUpdateNewInstance(input, instanceToUpdate?): Promise<StrategyInstance>

Parameters​

NameType
inputUpdateStrategyInstanceInput | CreateStrategyInstanceInput
instanceToUpdate?StrategyInstance

Returns​

Promise<StrategyInstance>

Inherited from​

StrategyUsingPassport.createOrUpdateNewInstance

Defined in​

login-service/src/strategies/Strategy.ts:76


createPassportStrategyInstance​

▸ createPassportStrategyInstance(strategyInstance): Strategy

Parameters​

NameType
strategyInstanceStrategyInstance

Returns​

Strategy

Overrides​

StrategyUsingPassport.createPassportStrategyInstance

Defined in​

login-service/src/strategies/jira/jira.service.ts:237


existsInstanceClearName​

▸ existsInstanceClearName(name): Promise<boolean>

Parameters​

NameType
namestring

Returns​

Promise<boolean>

Inherited from​

StrategyUsingPassport.existsInstanceClearName

Defined in​

login-service/src/strategies/Strategy.ts:116


getAdditionalPassportOptions​

▸ Protected getAdditionalPassportOptions(strategyInstance, authStateData): AuthenticateOptions

Parameters​

NameType
strategyInstanceStrategyInstance
authStateDataobject | AuthStateData

Returns​

AuthenticateOptions

Inherited from​

StrategyUsingPassport.getAdditionalPassportOptions

Defined in​

login-service/src/strategies/StrategyUsingPassport.ts:37


getAllInstances​

▸ getAllInstances(): Promise<StrategyInstance[]>

Returns​

Promise<StrategyInstance[]>

Inherited from​

StrategyUsingPassport.getAllInstances

Defined in​

login-service/src/strategies/Strategy.ts:120


getImsTemplatedValuesForStrategyInstance​

▸ getImsTemplatedValuesForStrategyInstance(instance): object | Promise<object>

Returns the object containing the templated fields and their values that an IMS needs to match, in order to be considered tha IMS that is represented by the strategy instance given. Values will be compared field by field with the templated values of the IMS.

The fields id, name and description of the returned object will not be compared to the templated values, but instead to the actual fields of the IMS with those respective names.

For example: The API-Url must match in order for a GitHub IMS belonging to a GitHub strategy instance

Can/Should be overridden by strategies capable of sync. Default implementation returns imsTemplatedFieldsFilter of instance config

Parameters​

NameTypeDescription
instanceStrategyInstanceThe strategy instance for which the templated values should be retuned

Returns​

object | Promise<object>

An object which, if it matches the templated fields of an IMS, the given instance is the matching strategy instance for that IMS Null if the strategy does not sync

Inherited from​

StrategyUsingPassport.getImsTemplatedValuesForStrategyInstance

Defined in​

login-service/src/strategies/Strategy.ts:161


getImsUserTemplatedValuesForLoginData​

▸ getImsUserTemplatedValuesForLoginData(loginData): object

Returns the object containing the templated fields and their values that an IMSUser needs to match, in order to be considered an IMSUser that belongs to the given loginData (i.e. the IMS is a login of the user of this login data on the ims of this login data)

The fields id, username, displayName and email of the returned object will not be compared to the templated values, but instead to the actual fields of the IMSUser with those respective names.

For example: The username on GitHub must match the username in the login data.

Can/Should/Must be overridden by strategies capable of sync. Default implementation returns the loginData.data field unchanged

Parameters​

NameTypeDescription
loginDataUserLoginDataThe login data for which the templated field values should be returned, representing a login of the user using a strategy instance

Returns​

object

An object which, if it matches the templated fields of an IMSUser, the given loginData is the matching login for that IMSUser Null if the strategy does not sync

Overrides​

StrategyUsingPassport.getImsUserTemplatedValuesForLoginData

Defined in​

login-service/src/strategies/jira/jira.service.ts:174


getInstanceById​

▸ getInstanceById(id): Promise<StrategyInstance>

Parameters​

NameType
idstring

Returns​

Promise<StrategyInstance>

Inherited from​

StrategyUsingPassport.getInstanceById

Defined in​

login-service/src/strategies/Strategy.ts:124


getLoginDataDataForImsUserTemplatedFields​

▸ getLoginDataDataForImsUserTemplatedFields(imsUser): object | Promise<object>

Does the opposite of getImsUserTemplatedValuesForLoginData.

Returns an object that needs to match the data field of a LoginData in order for the IMSUser to be considerd matching the login data.

The imsUserTemplatedFields should also contain the fields id, username, displayName and email directly of the IMSUser in addition to the templated fields and values.

For example: Given templated fields of an IMSUser containing its username, this should return the login data object that also matches the user with that username

Can/Should/Must be overridden by strategies capable of sync. Default implementation returns the imsUserTemplatedFields unchanged

Parameters​

NameTypeDescription
imsUserobjectTemplated fields and values as well as the fields id, username, displayName and email of the IMSUser.

Returns​

object | Promise<object>

An object, that the .data field of a login data needs to match.

Overrides​

StrategyUsingPassport.getLoginDataDataForImsUserTemplatedFields

Defined in​

login-service/src/strategies/jira/jira.service.ts:183


getPassportStrategyInstanceFor​

▸ getPassportStrategyInstanceFor(strategyInstance): Strategy

Parameters​

NameType
strategyInstanceStrategyInstance

Returns​

Strategy

Inherited from​

StrategyUsingPassport.getPassportStrategyInstanceFor

Defined in​

login-service/src/strategies/StrategyUsingPassport.ts:44


getSyncDataForLoginData​

▸ getSyncDataForLoginData(loginData): Promise<{ [key: string]: any; token: string }>

Parameters​

NameType
loginDataUserLoginData

Returns​

Promise<{ [key: string]: any; token: string }>

Overrides​

StrategyUsingPassport.getSyncDataForLoginData

Defined in​

login-service/src/strategies/jira/jira.service.ts:107


getUserDataSuggestion​

▸ getUserDataSuggestion(loginData): Object

For a given login data return data that has been retrieved from the authentication source with which to prefill the input fields for the user registration

WARNING: Does not check wether the returned data is valid or e.g. a username is unique. This is purely a data mapper.

Parameters​

NameTypeDescription
loginDataUserLoginDataThe login data of the authentication for which to retrieve the data

Returns​

Object

Suggestions for the user data based on the login data. NOT checked!

NameType
displayName?string
email?string
username?string

Overrides​

StrategyUsingPassport.getUserDataSuggestion

Defined in​

login-service/src/strategies/jira/jira.service.ts:189


passportUserCallback​

▸ Protected passportUserCallback(strategyInstance, accessToken, refreshToken, profile, done): Promise<void>

Finds the login data for the given strategy instance and the valued returned by Jira. To be executed as passport user callback.

Parameters​

NameTypeDescription
strategyInstanceStrategyInstanceThe instance of the Jira strategy for which to find the user
accessTokenstringThe access token returned by Jira
refreshTokenstringThe refreshToken returned by Jira
profileanyThe profile data for the logged in user returned by Jira
done(err: any, user: false | AuthResult, info: any) => voidThe done function to be called with the found login data or the error

Returns​

Promise<void>

Defined in​

login-service/src/strategies/jira/jira.service.ts:211


performAuth​

▸ performAuth(strategyInstance, authStateData, req, res): Promise<{ info: any ; result: AuthResult ; returnedState: AuthStateData }>

Parameters​

NameType
strategyInstanceStrategyInstance
authStateDataobject | AuthStateData
reqany
resany

Returns​

Promise<{ info: any ; result: AuthResult ; returnedState: AuthStateData }>

Inherited from​

StrategyUsingPassport.performAuth

Defined in​

login-service/src/strategies/StrategyUsingPassport.ts:57


toJSON​

▸ toJSON(): Object

Returns​

Object

NameType
acceptsVariables{ [variableName: string]: StrategyVariable; }
allowsImplicitSignupboolean
canLoginRegisterboolean
canSyncboolean
needsRedirectFlowboolean
typeNamestring

Inherited from​

StrategyUsingPassport.toJSON

Defined in​

login-service/src/strategies/Strategy.ts:249